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

MSOXCMAPIHTTP_S02_TC08_GetSpecialTable() private method

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

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

            #region Call GetSpecialTable request type to get an address creation table.
            uint flagsOfGetSpecialTable = (uint)NspiGetSpecialTableFlags.NspiAddressCreationTemplates;
            uint version = 0;
            STAT stat = new STAT();
            stat.InitiateStat();
            stat.CodePage = (uint)RequiredCodePages.CP_TELETEX;

            GetSpecialTableRequestBody getSpecialTableRequestBody = this.BuildGetSpecialTableRequestBody(flagsOfGetSpecialTable, true, stat, true, version);
            GetSpecialTableResponseBody getSpecialTableResponseBody = this.Adapter.GetSpecialTable(getSpecialTableRequestBody);

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

            // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R631
            this.Site.CaptureRequirementIfAreEqual<uint>(
                0,
                getSpecialTableResponseBody.ErrorCode,
                631,
                @"[In GetSpecialTable Request Type] The GetSpecialTable request type is used by the client to get a special table, which can be either an address book hierarchy table or an address creation table.");

            for (int i = 0; i < getSpecialTableResponseBody.RowCount; i++)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R677");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R677
                this.Site.CaptureRequirementIfIsInstanceOfType(
                    getSpecialTableResponseBody.Rows[i],
                    typeof(AddressBookPropertyValueList),
                    677,
                    @"[In GetSpecialTable Request Type  Success Response Body] Rows (optional) (variable): An array of AddressBookPropertyValueList structures, each of which contains a row of the table that the client requested.");
            }

            #endregion

            #region Call GetSpecialTable request type with flags field set to 0x00000000.
            getSpecialTableRequestBody.Flags = 0x00000000;
            stat.TemplateLocale = (uint)DefaultLCID.NSPI_DEFAULT_LOCALE;
            stat.CodePage = (uint)RequiredCodePages.CP_TELETEX;
            getSpecialTableRequestBody.State = stat;
            GetSpecialTableResponseBody getSpecialTableResponseBodyFlags0 = this.Adapter.GetSpecialTable(getSpecialTableRequestBody);
            Site.Assert.AreEqual<uint>(0, getSpecialTableResponseBodyFlags0.ErrorCode, "GetSpecialTable operation should succeed and 0 is expected to be returned. The return value is {0}.", getSpecialTableResponseBodyFlags0.ErrorCode);
            #endregion

            #region Call GetSpecialTable request type with flags field set to another value other than 0x0000000.
            getSpecialTableRequestBody.Flags = 0x00000001;
            stat.TemplateLocale = (uint)DefaultLCID.NSPI_DEFAULT_LOCALE;
            stat.CodePage = (uint)RequiredCodePages.CP_TELETEX;
            getSpecialTableRequestBody.State = stat;
            GetSpecialTableResponseBody getSpecialTableResponseBodyFlags1 = this.Adapter.GetSpecialTable(getSpecialTableRequestBody);
            Site.Assert.AreEqual<uint>(0, getSpecialTableResponseBodyFlags1.ErrorCode, "GetSpecialTable operation should succeed and 0 is expected to be returned. The return value is {0}.", getSpecialTableResponseBodyFlags1.ErrorCode);

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

            this.Site.Assert.AreEqual<uint>(getSpecialTableResponseBodyFlags0.RowCount.Value, getSpecialTableResponseBodyFlags1.RowCount.Value, "The two response bodies' RowCount field {0}, {1} should be equal.", getSpecialTableResponseBodyFlags0.RowCount.Value, getSpecialTableResponseBodyFlags1.RowCount.Value);
            for (int i = 0; i < getSpecialTableResponseBodyFlags0.RowCount; i++)
            {
                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1322
                this.Site.CaptureRequirementIfIsTrue(
                    AdapterHelper.AreTwoAddressBookPropValueListEqual(getSpecialTableResponseBodyFlags0.Rows[i], getSpecialTableResponseBodyFlags1.Rows[i]),
                    1322,
                    @"[In GetSpecialTable Request Type Request Body] If this field [Flags] is set to different values other than the bit flags NspiAddressCreationTemplates (0x00000002) and NspiUnicodeStrings (0x00000004), the server will return the same result.");
            }

            #endregion

            #region Call GetSpecialTable request type without state.

            GetSpecialTableRequestBody getSpecialTableRequestBodyWithoutState = this.BuildGetSpecialTableRequestBody(flagsOfGetSpecialTable, false, stat, true, version);
            GetSpecialTableResponseBody getSpecialTableResponseBodyWithoutState = this.Adapter.GetSpecialTable(getSpecialTableRequestBodyWithoutState);
            this.Site.Assert.AreEqual<uint>(0, getSpecialTableResponseBodyWithoutState.StatusCode, "GetSpecialTable should be accepted by the Address Book Server, the status code is {0}.", getSpecialTableResponseBodyWithoutState.StatusCode);
            #endregion

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