Microsoft.Protocols.TestSuites.MS_ASPROV.S03_ProvisionNegative.MSASPROV_S03_TC02_VerifyPolicyStatus5 C# (CSharp) Method

MSASPROV_S03_TC02_VerifyPolicyStatus5() private method

private MSASPROV_S03_TC02_VerifyPolicyStatus5 ( ) : void
return void
        public void MSASPROV_S03_TC02_VerifyPolicyStatus5()
        {
            #region Download the policy settings.
            // Download the policy settings.
            ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");
            string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;
            #endregion

            #region Acknowledge the policy settings.
            // Acknowledge the policy settings.
            this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1");
            #endregion

            #region Switch current user to the user who has custom policy settings.
            // Switch to the user who has been configured with custom policy.
            this.SwitchUser(this.User2Information, false);

            #endregion

            #region Call Provision command with out-of-date PolicyKey.
            provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1");

            byte policyStatus = provisionResponse.ResponseData.Policies.Policy.Status;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R475
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                475,
                @"[In Provision Command Errors] [The cause of status value 5 is] The client is trying to acknowledge an out-of-date [or invalid policy].");
            #endregion

            #region Call Provision command with invalid PolicyKey.
            provisionResponse = this.CallProvisionCommand("1234567890", "MS-EAS-Provisioning-WBXML", "1");

            policyStatus = provisionResponse.ResponseData.Policies.Policy.Status;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R761
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                761,
                @"[In Provision Command Errors] [The cause of status value 5 is] The client is trying to acknowledge an [out-of-date or] invalid policy.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R382
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                382,
                @"[In Status (Policy)] Value 5 means The client is acknowledging the wrong policy key.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R692
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                692,
                @"[In Provision Command Errors] [The meaning of status value] 5 [is] Policy key mismatch.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R507
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                507,
                @"[In Provision Command Errors] [When the scope is Policy], [the cause of status value 5 is] The client is trying to acknowledge an out-of-date or invalid policy.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R708
            // The Status of Policy element is 5, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual<byte>(
                5,
                policyStatus,
                708,
                @"[In Provision Command Errors] [When the scope is] Policy, [the meaning of status value] 5 [is] Policy key mismatch.");

            if (Common.IsRequirementEnabled(695, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R695");

                // Verify MS-ASPROV requirement: MS-ASPROV_R695
                // The Status of Policy element is 5, so this requirement can be captured.
                Site.CaptureRequirementIfAreEqual<byte>(
                    5,
                    policyStatus,
                    695,
                    @"[In Appendix B: Product Behavior] If it does not [current policy key sent by the client in a security policy settings acknowledgment does not match the temporary policy key issued by the server in the response to the initial request from this client], the implementation does return a Status (section 2.2.2.53.2) value of 5, as specified in section 3.2.5.2. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion
        }