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

MSOXCMAPIHTTP_S02_TC15_QueryColumns() private method

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

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

            #region Call QueryColumns to get all of the properties that exist in the address book.
            QueryColumnsRequestBody queryColumnsRequestBody = this.BuildQueryColumnsRequestBody((uint)NspiQueryColumnsFlag.NspiUnicodeProptypes);
            QueryColumnsResponseBody queryColumnsResponseBody = this.Adapter.QueryColumns(queryColumnsRequestBody);
            Site.Assert.AreEqual<uint>((uint)0, queryColumnsResponseBody.ErrorCode, "QueryColumns operation should succeed and 0 is expected to be returned. The return value is {0}.", queryColumnsResponseBody.ErrorCode);
            #endregion

            #region Call GetPropList method with Flags field set to 0x1 and MinimalId set to 0 to get the default global address book object.
            uint mid = 0;
            GetPropListRequestBody getPropListRequestBody = this.BuildGetPropListRequestBody(0x1, mid);
            GetPropListResponseBody getPropListResponseBody = this.Adapter.GetPropList(getPropListRequestBody);
            Site.Assert.AreEqual<uint>((uint)0, getPropListResponseBody.ErrorCode, "GetPropList operation should succeed and 0 is expected to be returned. The return value is {0}.", getPropListResponseBody.ErrorCode);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R865");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R865
            this.Site.CaptureRequirementIfAreEqual<uint>(
                getPropListResponseBody.PropertyTags.Value.PropertyTagCount,
                queryColumnsResponseBody.Columns.Value.PropertyTagCount,
                865,
                @"[In QueryColumns Request Type] The QueryColumns request type is used by the client to get a list of all of the properties that exist in the address book.");
            #endregion

            #region Call QueryColumns with MapiFlags set to one value rather than 0x80000000.
            uint mapiFlags1 = 0x0;
            QueryColumnsRequestBody queryColumnsRequestBody1 = this.BuildQueryColumnsRequestBody(mapiFlags1);
            QueryColumnsResponseBody queryColumnsResponseBody1 = this.Adapter.QueryColumns(queryColumnsRequestBody1);
            Site.Assert.AreEqual<uint>((uint)0, queryColumnsResponseBody1.ErrorCode, "QueryColumns operation should succeed and 0 is expected to be returned. The return value is {0}.", queryColumnsResponseBody1.ErrorCode);
            #endregion

            #region Call QueryColumns with MapiFlags set to another value rather than 0x80000000.
            uint mapiFlags2 = 0x1;
            QueryColumnsRequestBody queryColumnsRequestBody2 = this.BuildQueryColumnsRequestBody(mapiFlags2);
            QueryColumnsResponseBody queryColumnsResponseBody2 = this.Adapter.QueryColumns(queryColumnsRequestBody2);
            Site.Assert.AreEqual<uint>((uint)0, queryColumnsResponseBody2.ErrorCode, "QueryColumns operation should succeed and 0 is expected to be returned. The return value is {0}.", queryColumnsResponseBody2.ErrorCode);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1412");

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1412
            this.Site.CaptureRequirementIfIsTrue(
                AdapterHelper.AreTwoLargePropertyTagArrayEqual(queryColumnsResponseBody1.Columns.Value, queryColumnsResponseBody2.Columns.Value),
                1412,
                @"[In QueryColumns Request Type Request Body] If this field [MapiFlags] is set to different values other than the bit flag NspiUnicodeProptypes (0x80000000), the server will return the same result.");
            #endregion

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