Microsoft.Protocols.TestSuites.MS_OXNSPI.S05_NegativeBehavior.MSOXNSPI_S05_TC29_GetTemplateInfoFailedWithInvalidCodePage C# (CSharp) Method

MSOXNSPI_S05_TC29_GetTemplateInfoFailedWithInvalidCodePage() private method

        public void MSOXNSPI_S05_TC29_GetTemplateInfoFailedWithInvalidCodePage()
        {
            this.CheckProductSupported();
            this.CheckMAPIHTTPTransportSupported();

            #region Call NspiBind to initiate a session between the client and the server.
            uint flags = 0;
            STAT stat = new STAT();
            stat.InitiateStat();
            FlatUID_r guid = new FlatUID_r
            {
                Ab = new byte[16]
            };
            FlatUID_r? serverGuid = guid;

            this.Result = this.ProtocolAdatper.NspiBind(flags, stat, ref serverGuid);
            Site.Assert.AreEqual<ErrorCodeValue>(ErrorCodeValue.Success, this.Result, "NspiBind should return success!");
            #endregion

            #region Call NspiGetTemplateInfo with the CodePage field in the dwCodePage input parameter set to CP_WINUNICODE.
            uint flagsOfGetTemplateInfo = (uint)NspiGetTemplateInfoFlag.TI_HELPFILE_NAME;
            uint type = 0;
            string dn = null;
            uint codePage = (uint)RequiredCodePage.CP_WINUNICODE;
            uint locateID = stat.TemplateLocale;
            PropertyRow_r? data;

            this.Result = this.ProtocolAdatper.NspiGetTemplateInfo(flagsOfGetTemplateInfo, type, dn, codePage, locateID, out data);

            #region Capture

            this.VerifyWhetherppDataIsNullForNspiGetTemplateInfo(data);

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

            // Verify MS-OXNSPI requirement: MS-OXNSPI_R1467
            Site.CaptureRequirementIfAreEqual<ErrorCodeValue>(
                ErrorCodeValue.InvalidCodepage,
                this.Result,
                1467,
                @"[In NspiGetTemplateInfo] [Server Processing Rules: Upon receiving message NspiGetTemplateInfo, the server MUST process the data from the message subject to the following constraints:] [Constraint 3] If the codepage specified in the dwCodePage input parameter has the value CP_WINUNICODE, the server MUST return the value ""InvalidCodePage"".");

            #endregion Capture
            #endregion

            #region Call NspiGetTemplateInfo with the CodePage field in the dwCodePage input parameter set to an invalid value that the server cannot recognize.
            // If the server does not recognize the CodePage specified in the dwCodePage input parameter as a supported code page,
            // the server MUST return the value "InvalidCodePage".
            codePage = uint.Parse(Constants.UnrecognizedCodePage);
            this.Result = this.ProtocolAdatper.NspiGetTemplateInfo(flagsOfGetTemplateInfo, type, dn, codePage, locateID, out data);

            #region Capture

            this.VerifyWhetherppDataIsNullForNspiGetTemplateInfo(data);

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

            // Verify MS-OXNSPI requirement: MS-OXNSPI_R1469
            Site.CaptureRequirementIfAreEqual<ErrorCodeValue>(
                ErrorCodeValue.InvalidCodepage,
                this.Result,
                1469,
                @"[In NspiGetTemplateInfo] [Server Processing Rules: Upon receiving message NspiGetTemplateInfo, the server MUST process the data from the message subject to the following constraints:] [Constraint 4] If the server does not recognize the codepage specified in the dwCodePage input parameter as a supported code page, the server MUST return the value ""InvalidCodePage"".");

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

            // Verify MS-OXCDATA requirement: MS-OXCDATA_R973
            Site.CaptureRequirementIfAreEqual<ErrorCodeValue>(
                ErrorCodeValue.InvalidCodepage,
                this.Result,
                "MS-OXCDATA",
                973,
                @"[In Error Codes] InvalidCodepage(MAPI_E_UNKNOWN_CPID) will be returned, if the server is not configured to support the code
                page requested by the client.");

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

            // Verify MS-OXCDATA requirement: MS-OXCDATA_R974
            Site.CaptureRequirementIfAreEqual<uint>(
                 0x8004011E,
                (uint)this.Result,
                "MS-OXCDATA",
                974,
                @"[In Error Codes] The numeric value (hex) for error code InvalidCodepage is 0x8004011E, %x1E.01.04.80.");

            #endregion Capture
            #endregion

            #region Call NspiUnbind to destroy the session between the client and the server.
            uint returnValue = this.ProtocolAdatper.NspiUnbind(0);
            Site.Assert.AreEqual<uint>(1, returnValue, "NspiUnbind method should return 1 (Success).");
            #endregion
        }
S05_NegativeBehavior