Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.S02_RequestTypesForAddressBookServerEndpoint.MSOXCMAPIHTTP_S02_TC10_GetMatchesRequestType C# (CSharp) Method

MSOXCMAPIHTTP_S02_TC10_GetMatchesRequestType() private method

private MSOXCMAPIHTTP_S02_TC10_GetMatchesRequestType ( ) : void
return void
        public void MSOXCMAPIHTTP_S02_TC10_GetMatchesRequestType()
        {
            this.CheckMapiHttpIsSupported();

            #region Call Bind request type to established a session context with the address book server.
            this.Bind();
            #endregion

            #region Call GetMatches request type without MinimalIds, PropertyNameGuid or PropertyNameId.
            STAT stat = new STAT();
            stat.InitiateStat();

            PropertyTag pidTagDisplayNameTag = new PropertyTag((ushort)PropertyID.PidTagDisplayName, (ushort)PropertyTypeValues.PtypString);

            LargePropertyTagArray propTagArray = new LargePropertyTagArray();
            propTagArray.PropertyTagCount = 1;
            propTagArray.PropertyTags = new PropertyTag[]
            {
                pidTagDisplayNameTag
            };

            ExistRestriction existRestriction = new ExistRestriction()
            {
                PropTag = new PropertyTag((ushort)PropertyID.PidTagEntryId, (ushort)PropertyTypeValues.PtypBinary)
            };

            byte[] filter = existRestriction.Serialize();
            Guid propertyGuid = new Guid();
            uint propertyNameId = new uint();
            GetMatchesRequestBody getMatchRequestBody = this.BuildGetMatchRequestBody(true, stat, false, 0, null, true, filter, false, propertyGuid, propertyNameId, ConstValues.GetMatchesRequestedRowNumber, true, propTagArray);

            GetMatchesResponseBody getMatchesResponseBody = this.Adapter.GetMatches(getMatchRequestBody);
            this.Site.Assert.AreEqual<uint>(0, getMatchesResponseBody.ErrorCode, "GetMatches request should be executed successfully, the returned error code is {0}", getMatchesResponseBody.ErrorCode);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R443, the return count of rows in GetMatchs response is {0}", getMatchesResponseBody.RowCount);

            // If ErrorCode field is 0x0000000 and the RowsCount has values, then server returns the Explicit Table.
            // So R443 will be verified.
            this.Site.CaptureRequirementIfIsTrue(
                getMatchesResponseBody.ErrorCode == 0 && getMatchesResponseBody.RowData != null,
                443,
                @"[In GetMatches Request Type] The GetMatches request type is used by the client to get an Explicit Table, in which the rows are determined by the specified criteria.");
            #endregion

            #region Call GetMatches request type without State.
            STAT emptyStat = new STAT();
            getMatchRequestBody = this.BuildGetMatchRequestBody(false, emptyStat, false, 0, null, true, filter, false, propertyGuid, propertyNameId, 1, true, propTagArray);
            getMatchesResponseBody = this.Adapter.GetMatches(getMatchRequestBody);
            this.Site.Assert.AreEqual<uint>(0, getMatchesResponseBody.StatusCode, "GetMatches request should be executed successfully, the returned error code is {0}", getMatchesResponseBody.StatusCode);
            #endregion

            #region Call the Unbind request type to destroy the session context.
            this.Unbind();
            #endregion
        }