Beispiel #1
0
        public void MSASPROV_S01_TC03_InitialPreviouslySettingUnset()
        {
            #region Download the policy settings.
            // Download the policy settings.
            ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");

            // Because the user is allowe to download attachment.
            // So if AttachmentsEnabled element is true then R207 will be verified.
            this.Site.CaptureRequirementIfAreEqual <bool>(
                true,
                provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.AttachmentsEnabled,
                207,
                @"[In AttachmentsEnabled] Value 1 means Attachments are allowed to be downloaded.");

            if (Common.IsRequirementEnabled(1044, this.Site))
            {
                // Because the MinDevicePasswordLength is unset in previously set on the server.
                // So if the MinDevicePasswordLength element is emtry string then R1044 will be verified.
                this.Site.CaptureRequirementIfIsTrue(
                    string.IsNullOrEmpty(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MinDevicePasswordLength),
                    1044,
                    @"[In Appendix B: Product Behavior] When a policy setting that was previously set is unset on the server, the  implementation does specify the element that represents the setting as an empty tag [or a default value]. (Exchange 2007 and above follow this behavior.)");
            }

            if (Common.IsRequirementEnabled(1045, this.Site))
            {
                // Because the DevicePasswordHistory is unset in previously set on the server.
                // So if the DevicePasswordHistory element is default value(0) then R1045 will be verified.
                this.Site.CaptureRequirementIfIsTrue(
                    provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.DevicePasswordHistory == 0,
                    1045,
                    @"[In Appendix B: Product Behavior] When a policy setting that was previously set is unset on the server, the  implementation does specify the element that represents the setting as [an empty tag or] a default value. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion
        }
        public static ProvisionResponse GrantMsQuoteAccess(string env, string user, string mq1 = "D", string mq2 = "D", string mq3 = "D", string mq4 = "D", string qsu = "D", string mqf = "D", string qv = "D")
        {
            ProvisionResponse result = new ProvisionResponse();

            try
            {
                //if (string.IsNullOrWhiteSpace(user)) user = Thread.CurrentPrincipal.Identity.Name;

                ActiveDirectoryHelper.ValidateUser(user);

                bool response = SqlDataHelper.ProvisionMsQuote(env, Properties.Resources.Query_MSQuote, user, mq1, mq2, mq3, mq4, qsu, mqf, qv);

                if (!response)
                {
                    result.Status = "Success";
                    result.Reason = "Access Revoked";
                }
                else
                {
                    result.Status = "Success";
                    result.Reason = "Access Granted";
                }
            }
            catch (Exception ex)
            {
                result.Status = "Error";
                result.Reason = ex.Message;
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Call Provision command.
        /// </summary>
        /// <param name="policyKey">The policy key.</param>
        /// <param name="policyType">The format in which the policy settings are to be provided to the client device.</param>
        /// <param name="status">The status of the initial Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        protected ProvisionResponse CallProvisionCommand(string policyKey, string policyType, string status)
        {
            // Create Provision command request.
            ProvisionRequest provisionRequest = Common.CreateProvisionRequest(null, new Request.ProvisionPolicies(), null);

            Request.ProvisionPoliciesPolicy policy = new Request.ProvisionPoliciesPolicy {
                PolicyType = policyType
            };

            // The format in which the policy settings are to be provided to the client device.
            if (!string.IsNullOrEmpty(policyKey))
            {
                policy.PolicyKey = policyKey;
                policy.Status    = status;
            }
            else if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.1" ||
                     Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "16.0")
            {
                // Configure the DeviceInformation.
                Request.DeviceInformation    deviceInfomation     = new Request.DeviceInformation();
                Request.DeviceInformationSet deviceInformationSet = new Request.DeviceInformationSet
                {
                    Model = "ASPROVTest"
                };
                deviceInfomation.Set = deviceInformationSet;
                provisionRequest.RequestData.DeviceInformation = deviceInfomation;
            }

            provisionRequest.RequestData.Policies.Policy = policy;

            // Call Provision command.
            ProvisionResponse provisionResponse = this.PROVAdapter.Provision(provisionRequest);

            return(provisionResponse);
        }
        public void MSASPROV_S03_TC06_VerifyPolicyStatus145()
        {
            #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.

            if ("12.1" != Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                // Acknowledge the policy settings.
                provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "4");

                this.Site.CaptureRequirementIfAreEqual <byte>(
                    145,
                    provisionResponse.ResponseData.Status,
                    686,
                    @"[In Provision Command Errors] [The meaning of status value] 145 [is] The client is externally managed.");

                this.Site.CaptureRequirementIfAreEqual <byte>(
                    145,
                    provisionResponse.ResponseData.Status,
                    461,
                    @"[In Provision Command Errors] [The cause of status value 145 is] The client returned a value of 4 in the Status child element of the Policy element in a request to the server to acknowledge a policy.");

                this.Site.CaptureRequirementIfAreEqual <byte>(
                    145,
                    provisionResponse.ResponseData.Status,
                    687,
                    @"[In Provision Command Errors] [The cause of status value 145 is] The server is configured to not allow externally managed clients.");
            }
            #endregion
        }
        public static ProvisionResponse GrantMOETAccess(string env, string user)
        {
            ProvisionResponse result = new ProvisionResponse();

            try
            {
                //if (string.IsNullOrWhiteSpace(user)) user = Thread.CurrentPrincipal.Identity.Name;
                //else
                //{
                //    string emailAddress = ActiveDirectoryHelper.GetValue("mail", user);
                //}

                ActiveDirectoryHelper.ValidateUser(user);

                string response = SqlDataHelper.Provision(AppName.MOET, env, user, string.Empty, Properties.Resources.Query_MOETAccess);

                if (response == "1")
                {
                    result.Status = "Success";
                    result.Reason = "Access Granted";
                }
                else
                {
                    result.Status = "Error";
                    result.Reason = "Unable to grant MOET Access.";
                }
            }
            catch (Exception ex)
            {
                result.Status = "Error";
                result.Reason = ex.Message;
            }
            return(result);
        }
        public void MSASPROV_S03_TC05_VerifyPolicyStatus139()
        {
            #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.
            provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "2");

            if (Common.IsRequirementEnabled(1046, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    139,
                    provisionResponse.ResponseData.Status,
                    1046,
                    @"[In Appendix B: Product Behavior] [The cause of status value 139 is] The client returned a value of 2 in the Status child element of the Policy element in a request to the implementation to acknowledge a policy. (Exchange 2013 and above follow this behavior.)");

                this.Site.CaptureRequirementIfAreEqual <byte>(
                    139,
                    provisionResponse.ResponseData.Status,
                    681,
                    @"[In Provision Command Errors] [The meaning of status value] 139 [is] The client cannot fully comply with all requirements of the policy.");

                this.Site.CaptureRequirementIfAreEqual <byte>(
                    139,
                    provisionResponse.ResponseData.Status,
                    684,
                    @"[In Provision Command Errors] [The cause of status value 139 is] The server is configured to not allow clients that cannot fully apply the policy.");
            }
            #endregion
        }
        public void MSASPROV_S03_TC04_VerifyInvalidPolicyKey()
        {
            #region Call Provision command to download the policy settings.
            // Download the policy setting.
            ProvisionResponse provisionResponse  = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");
            string            temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;
            #endregion

            #region Call Provision command to acknowledge the policy settings and get the valid PolicyKey
            // Acknowledge the policy setting.
            provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1");

            string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;
            #endregion

            #region Call FolderSync command with an invalid PolicyKey which is different from the one got from last step.
            // Apply an invalid policy key
            this.PROVAdapter.ApplyPolicyKey(finalPolicyKey.Substring(0, 1));

            // Call folder sync with "0" in initialization phase.
            FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0");

            if ("12.1" == Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                string httpErrorCode = null;
                try
                {
                    this.PROVAdapter.FolderSync(folderSyncRequest);
                }
                catch (WebException exception)
                {
                    httpErrorCode = Common.GetErrorCodeFromException(exception);
                }

                Site.Assert.IsFalse(string.IsNullOrEmpty(httpErrorCode), "Server should return expected [449] error code if client do not have policy key");
            }
            else
            {
                FolderSyncResponse folderSyncResponse = this.PROVAdapter.FolderSync(folderSyncRequest);
                Site.Assert.AreEqual(144, int.Parse(folderSyncResponse.ResponseData.Status), "The server should return status 144 to indicate a invalid policy key.");
            }

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R537
                // If the above capture or assert passed, it means the server did returns a status code when the policy key is mismatched.
                Site.CaptureRequirement(
                    537,
                    @"[In Appendix B: Product Behavior] If the policy key received from the client does not match the stored policy key on the server [, or if the server determines that policy settings need to be updated on the client], the implementation does return a status code, as specified in [MS-ASCMD] section 2.2.4, in the next command response indicating that the client needs to send another Provision command to request the security policy settings and obtain a new policy key. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion
        }
Beispiel #8
0
        /// <summary>
        /// Request the security policy settings that the administrator sets from the server.
        /// </summary>
        /// <param name="provisionRequest">The request of Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        public ProvisionResponse Provision(ProvisionRequest provisionRequest)
        {
            ProvisionResponse provisionResponse = this.activeSyncClient.Provision(provisionRequest);

            Site.Assert.IsNotNull(provisionResponse, "The Provision response returned from server should not be null.");

            // Verify adapter requirements about Provision.
            this.VerifyProvisionCommandRequirements(provisionResponse);
            this.VerifyWBXMLRequirements();
            return(provisionResponse);
        }
        /// <summary>
        /// Get PolicyKey from Provision Response
        /// </summary>
        /// <param name="response">Provision Response</param>
        /// <returns>Policy Key, if the response doesn't contain the PolicyKey, returns null</returns>
        private static string GetPolicyKeyFromResponse(ProvisionResponse response)
        {
            if (null != response.ResponseData.Policies)
            {
                Response.ProvisionPoliciesPolicy policyInResponse = response.ResponseData.Policies.Policy;
                if (policyInResponse != null)
                {
                    return(policyInResponse.PolicyKey);
                }
            }

            return(null);
        }
            public void ReturnsCorrectUrlForDashboard()
            {
                var configuration   = Substitute.For <IConfiguration>();
                var databaseBuilder = Substitute.For <IDatabaseBuilder>();

                configuration.GetAppSetting(Arg.Any <string>()).Returns("dashboard");
                var service = new MsSqlCloudFoundryService(configuration, databaseBuilder);
                var request = new ProvisionRequest {
                    PlanId = MsSqlService.FreePlanId.ToString(), InstanceId = Guid.NewGuid().ToString()
                };

                ProvisionResponse response = service.Provision(request);

                Assert.Equal("dashboard", response.Url);
            }
Beispiel #11
0
        /// <summary>
        /// Acknowledge the current device policy setting.
        /// </summary>
        protected void AcknowledgeSecurityPolicySettings()
        {
            // Download the policy setting.
            ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");

            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

            string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;

            // Acknowledge the policy setting.
            provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1");
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

            this.PROVAdapter.ApplyPolicyKey(provisionResponse.ResponseData.Policies.Policy.PolicyKey);
        }
        /// <summary>
        /// Enables client devices to request the administrator's security policy settings on the server..
        /// </summary>
        /// <param name="request">A ProvisionRequest object that contains the request information.</param>
        /// <returns>Provision command response</returns>
        public ProvisionResponse Provision(ProvisionRequest request)
        {
            // When the value of the MS-ASProtocolVersion header is 14.0 or 12.1, the client MUST NOT send the setting:DeviceInformation element in any Provision command request.
            if (this.activeSyncClient.ActiveSyncProtocolVersion.Equals("140", StringComparison.OrdinalIgnoreCase) || this.activeSyncClient.ActiveSyncProtocolVersion.Equals("121", StringComparison.OrdinalIgnoreCase))
            {
                request.RequestData.DeviceInformation = null;
            }

            ProvisionResponse response = this.activeSyncClient.Provision(request);

            this.VerifyTransportRequirements();
            this.VerifyProvisionCommand(response);
            this.VerifyWBXMLCapture(CommandName.Provision, response);
            return(response);
        }
Beispiel #13
0
        /// <summary>
        /// Send string request of Provision command to the server and get the Provision response.
        /// </summary>
        /// <param name="provisionRequest">The string request of Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        public ProvisionResponse SendProvisionStringRequest(string provisionRequest)
        {
            SendStringResponse provisionStringResponse = this.activeSyncClient.SendStringRequest(CommandName.Provision, null, provisionRequest);

            Site.Assert.IsNotNull(provisionStringResponse, "The SendStringRequest response returned from server should not be null.");

            // Convert the SendStringResponse to ProvisionResponse.
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionStringResponse.ResponseDataXML
            };

            provisionResponse.DeserializeResponseData();

            return(provisionResponse);
        }
        public void MSASPROV_S03_TC07_VerifyStatus141()
        {
            #region Call Provision command to download the policy settings.
            // Download the policy setting.
            ProvisionResponse provisionResponse  = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");
            string            temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;
            #endregion

            #region Call Provision command to acknowledge the policy settings and get the valid PolicyKey
            // Acknowledge the policy setting.
            provisionResponse = this.CallProvisionCommand(temporaryPolicyKey, "MS-EAS-Provisioning-WBXML", "1");

            string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;
            #endregion

            #region Call FolderSync command with an emtry PolicyKey.
            if ("12.1" != Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                // Apply an emtry policy key
                this.PROVAdapter.ApplyPolicyKey(string.Empty);

                // Call folder sync with "0" in initialization phase.
                FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest("0");

                FolderSyncResponse folderSyncResponse = this.PROVAdapter.FolderSync(folderSyncRequest);

                this.Site.CaptureRequirementIfAreEqual <int>(
                    141,
                    int.Parse(folderSyncResponse.ResponseData.Status),
                    682,
                    @"[In Provision Command Errors] [The meaning of status value] 141 [is] The device is not provisionable.");

                this.Site.CaptureRequirementIfAreEqual <int>(
                    141,
                    int.Parse(folderSyncResponse.ResponseData.Status),
                    458,
                    @"[In Provision Command Errors] [The cause of status value 141 is] The client did not submit a policy key value in a request.");

                this.Site.CaptureRequirementIfAreEqual <int>(
                    141,
                    int.Parse(folderSyncResponse.ResponseData.Status),
                    685,
                    @"[In Provision Command Errors] [The cause of status value 141 is] The server is configured to not allow clients that do not submit a policy key value.");
            }
            #endregion
        }
        public void MSASCMD_S21_TC14_CommonStatusCode_145()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "This test case is not supported when the MS-ASProtocolVersion header is set to 12.1.. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region User calls Provision command to download policies from server
            // Calls Provision command to download policies
            ProvisionRequest  provisionRequest  = TestSuiteBase.GenerateDefaultProvisionRequest();
            ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest);


            // Get policyKey, policyType and statusCode from server response
            string policyKey = null;
            if (null != provisionResponse.ResponseData.Policies)
            {
                Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy;
                if (policyInResponse != null)
                {
                    policyKey = policyInResponse.PolicyKey;
                }
            }

            string policyType = provisionResponse.ResponseData.Policies.Policy.PolicyType;
            Response.ProvisionPoliciesPolicyData data = provisionResponse.ResponseData.Policies.Policy.Data;
            byte statusCode = provisionResponse.ResponseData.Status;
            #endregion

            #region User calls Provision command to acknowledge policies.

            // Set acknowledgeStatus value to 1, means accept the policy.
            ProvisionRequest provisionAcknowledgeRequest = TestSuiteBase.GenerateDefaultProvisionRequest();
            provisionAcknowledgeRequest.RequestData.Policies.Policy.PolicyKey = policyKey;
            provisionAcknowledgeRequest.RequestData.Policies.Policy.Status    = "4";

            // Calls Provision command
            ProvisionResponse provisionAcknowledgeResponse = this.CMDAdapter.Provision(provisionAcknowledgeRequest);
            statusCode = provisionAcknowledgeResponse.ResponseData.Status;

            this.Site.CaptureRequirementIfAreEqual <byte>(
                145,
                statusCode,
                4917,
                @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0,  [The meaning of the status value 145 is] The device claimed to be externally managed, but the server doesn't allow externally managed devices to sync.");
            #endregion
        }
        public void MSASPROV_S03_TC01_VerifyPolicyStatus3()
        {
            #region Call Provision command with invalid policy type.
            // Assign an invalid policy type in the provision request
            string            invalidType       = "InvalidMS-EAS-Provisioning-WBXML";
            ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, invalidType, "1");

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

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R380
            // The Status of Policy element is 3, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                3,
                policyStatus,
                380,
                @"[In Status (Policy)] Value 3 means Unknown PolicyType value.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R471
            // The Status of Policy element is 3, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                3,
                policyStatus,
                471,
                @"[In Provision Command Errors] [The cause of status value 3 is] The client sent a policy that the server does not recognize.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R502
            // The Status of Policy element is 3, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                3,
                policyStatus,
                502,
                @"[In Provision Command Errors] [When the scope is Policy], [the cause of status value 3 is] The client sent a policy that the server does not recognize.");
            #endregion
        }
        public void MSASCMD_S12_TC02_Provision_WithoutPolicyTypeElement()
        {
            #region User calls Provision command to download policies without policy type element in request.
            ProvisionRequest provisionRequest = TestSuiteBase.GenerateDefaultProvisionRequest();

            // Set the policy type Element value to null
            provisionRequest.RequestData.Policies.Policy.PolicyType = null;
            ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4989
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                provisionResponse.ResponseData.Status,
                4989,
                @"[In Downloading Policy Settings] If the provision:PolicyType element is not included in the initial Provision command request, the server responds with a provision:Status element value of 2.");
            #endregion
        }
        public IHttpActionResult Provision(string instanceId, [FromBody] ProvisionRequest request)
        {
            ICloudFoundryService service;

            if (!servicesCatalog.Services.TryGetValue(request.ServiceId, out service))
            {
                return(BadRequest("This broker does not support the requested service."));
            }

            request.InstanceId = instanceId;

            try
            {
                ProvisionResponse response = service.Provision(request);
                return(Content(HttpStatusCode.Created, response));
            }
            catch (InvalidOperationException)
            {
                return(Conflict());
            }
        }
        public static ProvisionResponse GrantMSLAccess(string env, string user, string pcn, bool needPQRole)
        {
            ProvisionResponse result = new ProvisionResponse();

            try
            {
                //if (string.IsNullOrWhiteSpace(user)) user = Thread.CurrentPrincipal.Identity.Name;

                ActiveDirectoryHelper.ValidateUser(user);

                string response = SqlDataHelper.Provision(AppName.MSL, env, user, pcn, (needPQRole ? Properties.Resources.Query_MSL_PQ : Properties.Resources.Query_MSLAccess));

                using (XmlReader reader = XmlReader.Create(new StringReader(response)))
                {
                    XElement            root             = XElement.Load(reader);
                    XmlNameTable        nameTable        = reader.NameTable;
                    XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable);
                    namespaceManager.AddNamespace("ns1", "http://MS.IT.Ops.MSLicense.TransactionService.DataContracts/");

                    XElement element = root.XPathSelectElement("/ns1:Accessor/ns1:AccessorStatus/ns1:StatusID", namespaceManager);

                    if (element == null || element.Value != "1")
                    {
                        result.Status = "Error";
                    }
                    else
                    {
                        result.Status = "Success";
                        result.Reason = "Access Granted";
                    }
                }
            }
            catch (Exception ex)
            {
                result.Status = "Error";
                result.Reason = ex.Message;
            }
            return(result);
        }
        /// <summary>
        /// Get policy key from Provision string response.
        /// </summary>
        /// <param name="provisionResponseString">The SendStringResponse instance of Provision command.</param>
        /// <returns>The policy key of the policy.</returns>
        public static string GetPolicyKeyFromSendString(ActiveSyncResponseBase<object> provisionResponseString)
        {
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionResponseString.ResponseDataXML
            };

            if (!string.IsNullOrEmpty(provisionResponse.ResponseDataXML))
            {
                provisionResponse.DeserializeResponseData();

                if (provisionResponse.ResponseData.Policies != null)
                {
                    Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy;
                    if (policyInResponse != null)
                    {
                        return policyInResponse.PolicyKey;
                    }
                }
            }

            return string.Empty;
        }
Beispiel #21
0
        /// <summary>
        /// Get policy key from Provision string response.
        /// </summary>
        /// <param name="provisionResponseString">The SendStringResponse instance of Provision command.</param>
        /// <returns>The policy key of the policy.</returns>
        public static string GetPolicyKeyFromSendString(ActiveSyncResponseBase <object> provisionResponseString)
        {
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionResponseString.ResponseDataXML
            };

            if (!string.IsNullOrEmpty(provisionResponse.ResponseDataXML))
            {
                provisionResponse.DeserializeResponseData();

                if (provisionResponse.ResponseData.Policies != null)
                {
                    Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy;
                    if (policyInResponse != null)
                    {
                        return(policyInResponse.PolicyKey);
                    }
                }
            }

            return(string.Empty);
        }
        public void MSASCMD_S21_TC03_CommonStatusCode_165()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 165 is not returned when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 165 is not returned when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region User calls Provision command without the DeviceInformation element

            ProvisionRequest provisionRequest = TestSuiteBase.GenerateDefaultProvisionRequest();
            provisionRequest.RequestData.DeviceInformation = null;

            ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest);

            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4954
            Site.CaptureRequirementIfAreEqual <byte>(
                165,
                provisionResponse.ResponseData.Status,
                4954,
                @"[In Common Status Codes] [The meaning of the status value 165 is] The required DeviceInformation element (as specified in [MS-ASPROV] section 2.2.2.52) is missing in the Provision request.<99>");
        }
        /// <summary>
        /// Verify Provision command requirements.
        /// </summary>
        /// <param name="provisionResponse">Provision response</param>
        private void VerifyProvisionCommandRequirements(ProvisionResponse provisionResponse)
        {
            // If the schema validation is successful, then following requirements can be captured.
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "Schema validation should be successful.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R600
            // The schema has been validated, so this requirement can be captured.
            Site.CaptureRequirement(
                600,
                @"[In Transport] The XML markup that constitutes the request body or the response body that is transmitted between the client and the server uses Wireless Application Protocol (WAP) Binary XML (WBXML), as specified in [MS-ASWBXML].");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R319
            // The ResponseData is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                provisionResponse.ResponseData,
                319,
                @"[In Provision] The Provision element is a required container ([MS-ASDTYPE] section 2.2) element in a provisioning request and response that specifies the capabilities and permissions of a device.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R320
            // The schema has been validated, so this requirement can be captured.
            Site.CaptureRequirement(
                320,
                @"[In Provision] The Provision element has the following child elements:
settings:DeviceInformation (section 2.2.2.52)
Status (section 2.2.2.53)
Policies (section 2.2.2.39)
RemoteWipe (section 2.2.2.44).");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R759
            // The schema has been validated, so this requirement can be captured.
            Site.CaptureRequirement(
                759,
                @"[In Status] The Status element is a child element of the Provision element (section 2.2.2.43).");

            // Verify requirements of DeviceInformation.
            if (null != provisionResponse.ResponseData.DeviceInformation)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R366");

                // Verify MS-ASPROV requirement: MS-ASPROV_R366
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    366,
                    @"[In settings:DeviceInformation] It [settings:DeviceInformation element] is a child of the Provision element (section 2.2.2.43).");

                this.VerifyContainerStructure();
            }

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R390
            // The Status element in Provision is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                provisionResponse.ResponseData.Status,
                390,
                @"[In Status (Provision)] The Status (Provision) element is a required child element of the Provision element in command responses.");

            this.VerifyUnsignedByteStructure(provisionResponse.ResponseData.Status);

            if (provisionResponse.ResponseData.Status < 100)
            {
                bool isVerifiedR393 = provisionResponse.ResponseData.Status == 1 || provisionResponse.ResponseData.Status == 2 || provisionResponse.ResponseData.Status == 3;

                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR393,
                    393,
                    @"[In Status (Provision)] The following table lists valid values [1,2,3] for the Status (Provision) element when it is the child of the Provision element.");
            }

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R391
            // The schema has been validated, so this requirement can be captured.
            Site.CaptureRequirement(
                391,
                @"[In Status (Provision)] The value of this element [Status (Provision)] is an unsignedByte ([MS-ASDTYPE] section 2.7).");

            // Verify requirements of Policies.
            if (null != provisionResponse.ResponseData.Policies)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R303");

                // Verify MS-ASPROV requirement: MS-ASPROV_R303
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    303,
                    @"[In Policies] The Policies element is a required container ([MS-ASDTYPE] section 2.2) element that specifies a collection of security policies.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R304
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    304,
                    @"[In Policies] It [Policies element] is a child of the Provision element (section 2.2.2.43).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R307
                // The Policy element is not null, so this requirement can be captured.
                Site.CaptureRequirementIfIsNotNull(
                    provisionResponse.ResponseData.Policies.Policy,
                    307,
                    @"[In Policy] The Policy element is a required container ([MS-ASDTYPE] section 2.2) element that specifies a policy.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R306
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    306,
                    @"[In Policies] The Policies element has only the following child element: Policy (section 2.2.2.40): At least one element of this type is required.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R308
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    308,
                    @"[In Policy] It [Policy element] is a child of the Policies element (section 2.2.2.39).");

                // Verify requirements of PolicyType.
                if (null != provisionResponse.ResponseData.Policies.Policy.PolicyType)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R317");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R317
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        317,
                        @"[In PolicyType] The PolicyType element is a child element of type string ([MS-ASDTYPE] section 2.6) of the Policy element (section 2.2.2.40).");

                    if (provisionResponse.ResponseData.Policies.Policy.Status != 3)
                    {
                        // Add the debug information
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R318");

                        // Verify MS-ASPROV requirement: MS-ASPROV_R318
                        bool isR318Satisfied = provisionResponse.ResponseData.Policies.Policy.PolicyType.Equals("MS-WAP-Provisioning-XML") || provisionResponse.ResponseData.Policies.Policy.PolicyType.Equals("MS-EAS-Provisioning-WBXML");

                        Site.CaptureRequirementIfIsTrue(
                            isR318Satisfied,
                            318,
                            @"[In PolicyType] The value of the PolicyType element MUST be one of the values specified in the following table.
[MS-WAP-Provisioning-XML
MS-EAS-Provisioning-WBXML]");
                    }

                    this.VerifyStringStructure();
                }

                // Verify requirements of PolicyKey.
                if (null != provisionResponse.ResponseData.Policies.Policy.PolicyKey)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R313");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R313
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        313,
                        @"[In PolicyKey] It [PolicyKey] is a child element of the Policy element (section 2.2.2.40).");

                    this.VerifyStringStructure();

                    if (Common.IsRequirementEnabled(711, Site))
                    {
                        uint uintPolicyKey;

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

                        // Verify MS-ASPROV requirement: MS-ASPROV_R711
                        // The PolicyKey could be parsed to unsigned integer, so this requirement can be captured.
                        Site.CaptureRequirementIfIsTrue(
                            uint.TryParse(provisionResponse.ResponseData.Policies.Policy.PolicyKey, out uintPolicyKey),
                            711,
                            @"[In Appendix A: Product Behavior] The value of the PolicyKey element is a string representation of a 32-bit unsigned integer. (Exchange 2007 and above follow this behavior.)");
                    }
                }

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R374
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    374,
                    @"[In Status (Policy)] The Status element is a required child of the Policy element in command responses.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R370
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    370,
                    @"[In Status] The Status element is a child element of the Policy element (section 2.2.2.40).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R375
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    375,
                    @"[In Status (Policy)] In a command response, the value of this element [Status (Policy)] is an unsignedByte ([MS-ASDTYPE] section 2.7).");

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

                Common.VerifyActualValues("Status(Policy)", new string[] { "1", "2", "3", "4", "5" }, provisionResponse.ResponseData.Policies.Policy.Status.ToString(), Site);

                // Verify MS-ASPROV requirement: MS-ASPROV_R377
                // The actual value of Status element is one of the valid values, so this requirement can be captured.
                Site.CaptureRequirement(
                    377,
                    @"[In Status (Policy)] The following table lists valid values [1,2,3,4,5] for the Status (Policy) element when it is the child of the Policy element in the response from the server to the client.");

                this.VerifyUnsignedByteStructure(provisionResponse.ResponseData.Policies.Policy.Status);

                // Verify requirements of Data.
                if (null != provisionResponse.ResponseData.Policies.Policy.Data)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R208");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R208
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        208,
                        @"[In Data (container Data Type)] The Data element as a container data type ([MS-ASDTYPE] section 2.2) contains a child element in which the policy settings for a device are specified. ");

                    this.Site.CaptureRequirementIfAreEqual<string>(
                        "MS-EAS-Provisioning-WBXML",
                        provisionResponse.ResponseData.Policies.Policy.PolicyType,
                        966,
                        @"[In PolicyType] Value MS-EAS-Provisioning-WBXML meaning The contents of the Data element are formatted according to the Exchange ActiveSync provisioning WBXML schema, as specified in section 2.2.2.23.1.");

                    if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") ||
                        Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0") ||
                        Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.1") ||
                        Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0"))
                    {
                        this.Site.CaptureRequirementIfAreEqual<string>(
                            "MS-EAS-Provisioning-WBXML",
                            provisionResponse.ResponseData.Policies.Policy.PolicyType,
                            971,
                            @"[In PolicyType] The value ""MS-EAS-Provisioning-WBXML"" is used with protocol versions 12.0, 12.1, 14.0, 14.1, and 16.0.");
                    }

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R210
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        210,
                        @"[In Data (container Data Type)] As a container data type, the Data element has only the following child element: EASProvisionDoc (section 2.2.2.27): One instance of this element is required.");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R232
                    // The EASProvisionDoc element is not null, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNotNull(
                        provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc,
                        232,
                        @"[In EASProvisionDoc] The EASProvisionDoc element is a required container ([MS-ASDTYPE] section 2.2) element that specifies the collection of security settings for device provisioning.");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R233
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        233,
                        @"[In EASProvisionDoc] It [EASProvisionDoc element] is a child of the Data element (section 2.2.2.23).");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R234
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        234,
                        @"[In EASProvisionDoc] A command response has a minimum of one EASProvisionDoc element per Data element.");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R235
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        235,
                        @"[In EASProvisionDoc] The EASProvisionDoc element has only the following child elements:
AllowBluetooth (section 2.2.2.1)
AllowBrowser (section 2.2.2.2)
AllowCamera (section 2.2.2.3)
AllowConsumerEmail (section 2.2.2.4)
AllowDesktopSync (section 2.2.2.5)
AllowHTMLEmail (section 2.2.2.6)
AllowInternetSharing (section 2.2.2.7)
AllowIrDA (section 2.2.2.8)
AllowPOPIMAPEmail (section 2.2.2.9)
AllowRemoteDesktop (section 2.2.2.10)
AllowSimpleDevicePassword (section 2.2.2.11)
AllowSMIMEEncryptionAlgorithmNegotiation (section 2.2.2.12)
AllowSMIMESoftCerts (section 2.2.2.13)
AllowStorageCard (section 2.2.2.14)
AllowTextMessaging (section 2.2.2.15)
AllowUnsignedApplications (section 2.2.2.16)
AllowUnsignedInstallationPackages (section 2.2.2.17)
AllowWifi (section 2.2.2.18)
AlphanumericDevicePasswordRequired (section 2.2.2.19)
ApprovedApplicationList (section 2.2.2.21)
AttachmentsEnabled (section 2.2.2.22)
DevicePasswordEnabled (section 2.2.2.24)
DevicePasswordExpiration (section 2.2.2.25)
DevicePasswordHistory (section 2.2.2.26)
MaxAttachmentSize (section 2.2.2.29)
MaxCalendarAgeFilter (section 2.2.2.30)
MaxDevicePasswordFailedAttempts (section 2.2.2.31)
MaxEmailAgeFilter (section 2.2.2.32)
MaxEmailBodyTruncationSize (section 2.2.2.33)
MaxEmailHTMLBodyTruncationSize (section 2.2.2.34)
MaxInactivityTimeDeviceLock (section 2.2.2.35)
MinDevicePasswordComplexCharacters (section 2.2.2.36)
MinDevicePasswordLength (section 2.2.2.37)
PasswordRecoveryEnabled (section 2.2.2.38)
RequireDeviceEncryption (section 2.2.2.45)
RequireEncryptedSMIMEMessages (section 2.2.2.46)
RequireEncryptionSMIMEAlgorithm (section 2.2.2.47)
RequireManualSyncWhenRoaming (section 2.2.2.48)
RequireSignedSMIMEAlgorithm (section 2.2.2.49)
RequireSignedSMIMEMessages (section 2.2.2.50)
RequireStorageCardEncryption (section 2.2.2.51)
UnapprovedInROMApplicationList (section 2.2.2.54)");

                    this.VerifyEASProvisionDocElement(provisionResponse);

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

                        // Verify MS-ASPROV requirement: MS-ASPROV_R535
                        // The schema has been validated and RemoteWipe element is null, so this requirement can be captured.
                        Site.CaptureRequirementIfIsNull(
                            provisionResponse.ResponseData.RemoteWipe,
                            535,
                            @"[In Appendix A: Product Behavior] The implementation does respond to a security policy settings request in an initial Provision command request with a response in the following format. (Exchange 2007 and above follow this behavior.)
<Provision>
   <settings:DeviceInformation>
      <settings:Status>...</settings:Status>
   </settings:DeviceInformation>
   <Status>...</Status>
   <Policies>
      <Policy>
         <PolicyType>MS-EAS-Provisioning-WBXML</PolicyType>
         <Status>...</Status>
         <PolicyKey>...</PolicyKey>
         <Data>
            <EASProvisionDoc>
               ...
            </EASProvisionDoc>
         </Data>
      </Policy>
   </Policies>
</Provision>");
                    }

                    this.VerifyContainerStructure();
                }
                else
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R661");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R661
                    // The schema has been validated and the RemoteWipe element is null, so this requirement can be captured.
                    Site.CaptureRequirementIfIsNull(
                        provisionResponse.ResponseData.RemoteWipe,
                        661,
                        @"[In Responding to a Security Policy Settings Acknowledgment] If the level of compliance meets the server's requirements, the server response is in the following format.
<Provision>
   <Status>...</Status>
   <Policies>
      <Policy>
         <PolicyType>...</PolicyType>
         <Status>...</Status>
         <PolicyKey>...</PolicyKey>
      </Policy>
   </Policies>
</Provision>");
                }

                this.VerifyContainerStructure();
            }

            // Verify requirements of RemoteWipe.
            if (null != provisionResponse.ResponseData.RemoteWipe)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R321");

                // Verify MS-ASPROV requirement: MS-ASPROV_R321
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    321,
                    @"[In RemoteWipe] The RemoteWipe element is an optional container ([MS-ASDTYPE] section 2.2) element.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R322
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    322,
                    @"[In RemoteWipe] A server response MUST NOT include any child elements in the RemoteWipe element.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R760
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    760,
                    @"[In Status] The Status element is a child element of the RemoteWipe element (section 2.2.2.44).");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R758
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        758,
                        @"[In Appendix B: Product Behavior] The implementation does respond to an empty initial Provision command request with a response in the following format. (Exchange 2007 and above follow this behavior.)
<Provision>
   <Status>...</Status>
   <RemoteWipe/>
</Provision>");
                }

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R666
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    666,
                    @"[In Responding to a Remote Wipe Directive Acknowledgment] The server's response is in the following format. <Provision> <Status>...</Status> <RemoteWipe/> </Provision>");

                this.VerifyContainerStructure();
            }

            this.VerifyContainerStructure();
        }
Beispiel #24
0
        public void MSASPROV_S01_TC01_AcknowledgeSecurityPolicySettings()
        {
            #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 Download the policy settings.
            // Download the policy settings.
            ProvisionResponse provisionResponse = this.CallProvisionCommand(string.Empty, "MS-EAS-Provisioning-WBXML", "1");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R394
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                provisionResponse.ResponseData.Status,
                394,
                @"[In Status (Provision)] Value 1 means Success.");

            string temporaryPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;

            // Get the policy element from the Provision response.
            Response.ProvisionPoliciesPolicy policy = provisionResponse.ResponseData.Policies.Policy;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R310
            // The PolicyType, PolicyKey, Status and Data elements are not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                policy.Data != null && policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0,
                310,
                @"[In Policy] In the initial Provision command response, the Policy element has only the following child elements: PolicyType (section 2.2.2.42) (required) PolicyKey (section 2.2.2.41) (required) Status (section 2.2.2.53) (required) Data (section 2.2.2.23) ( required).");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R417
            // The PolicyType, PolicyKey, Status and Data elements are not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                policy.Data != null && policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0,
                417,
                @"[In Abstract Data Model] In order 1, the server response contains the policy type, policy key, data, and status code.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R378
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                policy.Status,
                378,
                @"[In Status (Policy)] Value 1 means Success.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R209
            // The Data element is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                policy.Data,
                209,
                @"[In Data (container Data Type)] It [Data element] is a required child element of the Policy element (section 2.2.2.40) in responses to initial Provision command requests, as specified in section 3.2.5.1.1.");

            // Because the user is not allowe to download attachment.
            // So if AttachmentsEnabled element is false then R206 will be verified.
            this.Site.CaptureRequirementIfAreEqual <bool>(
                false,
                policy.Data.EASProvisionDoc.AttachmentsEnabled,
                206,
                @"[In AttachmentsEnabled] Value 0 means Attachments are not allowed to be downloaded.");

            // Because if the Data element is a container Data type, then the Data element should contain the EASProvisionDoc element.
            // So if the Data element contain the EASProvisionDoc element and the PolicyType element is set to "MS-EAS-Provisioning-WBXML", then R888 will be verified.
            this.Site.CaptureRequirementIfIsTrue(
                policy.Data.EASProvisionDoc != null && policy.PolicyType == "MS-EAS-Provisioning-WBXML",
                888,
                @"[In Data (container Data Type)] This element [Data (container Data Type)] requires that the PolicyType element (section 2.2.2.42) is set to ""MS-EAS-Provisioning-WBXML"".");

            this.Site.CaptureRequirementIfIsTrue(
                !string.IsNullOrEmpty(policy.PolicyKey),
                486,
                @"[In Provision Command] The server generates, stores, and sends the policy key when it responds to a Provision command request for policy settings.");
            #endregion

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

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R678
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                provisionResponse.ResponseData.Status,
                678,
                @"[In Provision Command Errors] [The meaning of status value] 1 [is] Success.");

            bool isR441Verified = provisionResponse.ResponseData.Policies != null && provisionResponse.ResponseData.Status == 1;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R441
            // The Policies element is not null and the value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isR441Verified,
                441,
                @"[In Provision Command Errors] [The cause of status value 1 is] The Policies element contains information about security policies.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R650
            // The acknowledgement Provision succeeds and PolicyKey element is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                temporaryPolicyKey,
                650,
                @"[In Responding to an Initial Request] The value of the PolicyKey element (section 2.2.2.41) is a temporary policy key that will be valid only for an acknowledgment request to acknowledge the policy settings contained in the Data element.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R657
            // The command executed successfully using the temporary PolicyKey, so this requirement can be captured.
            Site.CaptureRequirement(
                657,
                @"[In Responding to a Security Policy Settings Acknowledgment] The server MUST ensure that the current policy key sent by the client in a security policy settings acknowledgment matches the temporary policy key issued by the server in the response to the initial request from this client.");

            // Get the policy element from the Provision response.
            policy = provisionResponse.ResponseData.Policies.Policy;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R605
            // The PolicyType, PolicyKey and Status elements are not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0,
                605,
                @"[In Policy] In the acknowledgment Provision command response, the Policy element has the following child elements: PolicyType (section 2.2.2.42) (required) PolicyKey (section 2.2.2.41) (required) Status (section 2.2.2.53) (required).");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R419
            // The PolicyType, PolicyKey and Status elements are not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                policy.PolicyKey != null && policy.PolicyType != null && policy.Status != 0,
                419,
                @"[In Abstract Data Model] In order 2, the server response contains the policy type, policy key, and status code to indicate that the server recorded the client's acknowledgement.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R688
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                policy.Status,
                688,
                @"[In Provision Command Errors] [The meaning of status value] 1 [is] Success.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R466
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                policy.Status,
                466,
                @"[In Provision Command Errors] [The cause of status value 1 is] The requested policy data is included in the response.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R703
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                policy.Status,
                703,
                @"[In Provision Command Errors] [When the scope is] Policy, [the meaning of status value] 1 [is] Success.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R495
            // The value of Status is 1, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                1,
                policy.Status,
                495,
                @"[In Provision Command Errors] [When the scope is Policy], [the cause of status value 1 is] The requested policy data is included in the response.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R601
            // The Data element is null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNull(
                policy.Data,
                601,
                @"[In Data (container Data Type)] It [Data element] is not present in responses to acknowledgment requests, as specified in section 3.2.5.1.2.");
            #endregion

            #region Apply the final policy key got from acknowledgement Provision response.
            // Get the final policy key from the Provision command response.
            string finalPolicyKey = provisionResponse.ResponseData.Policies.Policy.PolicyKey;

            // Apply the final policy key for the subsequence commands.
            this.PROVAdapter.ApplyPolicyKey(finalPolicyKey);
            #endregion

            #region Call FolderSync command with the final policy key.
            FolderSyncRequest  folderSyncRequest = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse folderSynReponse  = this.PROVAdapter.FolderSync(folderSyncRequest);
            Site.Assert.AreEqual(folderSynReponse.StatusCode, HttpStatusCode.OK, "Server should return a HTTP expected status code [{0}] after apply Policy Key, actual is [{1}]", HttpStatusCode.OK, folderSynReponse.StatusCode);

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R662
            // The FolderSync command executed successfully after the final policy key is applied, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                finalPolicyKey,
                662,
                @"[In Responding to a Security Policy Settings Acknowledgment] The value of the PolicyKey element (section 2.2.2.41) is a permanent policy key that is valid for subsequent command requests from the client.");
            #endregion
        }
        public void MSASCMD_S12_TC03_Provision_Status144()
        {
            #region User calls Provision command to download policies from server
            // Calls Provision command to download policies
            ProvisionRequest  provisionRequest  = TestSuiteBase.GenerateDefaultProvisionRequest();
            ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest);
            Site.Assert.AreEqual(1, provisionResponse.ResponseData.Status, "If Provision operation executes successfully, server should return status 1");

            // Get policyKey
            string policyKey = GetPolicyKeyFromResponse(provisionResponse);
            #endregion

            #region User calls Provision command to acknowledge policies.
            // Set acknowledgeStatus value to 1, means accept the policy.
            string           acknowledgeStatus           = "1";
            ProvisionRequest provisionAcknowledgeRequest = TestSuiteBase.GenerateDefaultProvisionRequest();
            provisionAcknowledgeRequest.RequestData.Policies.Policy.PolicyKey = policyKey;
            provisionAcknowledgeRequest.RequestData.Policies.Policy.Status    = acknowledgeStatus;

            // Calls Provision command
            ProvisionResponse provisionAcknowledgeResponse = this.CMDAdapter.Provision(provisionAcknowledgeRequest);
            Site.Assert.AreEqual(1, provisionResponse.ResponseData.Status, "If Provision operation executes successfully, server should return status 1");

            // Get policyKey
            string finalPolicyKey = GetPolicyKeyFromResponse(provisionAcknowledgeResponse);
            #endregion

            #region Call FolderSync command with an invalid PolicyKey which is different from the one got from last step.
            this.CMDAdapter.ChangePolicyKey(finalPolicyKey.Substring(0, 1));
            this.RecordPolicyKeyChanged();

            if ("12.1" == Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site))
            {
                string httpErrorCode = null;
                try
                {
                    // Call FolderSync command
                    this.CMDAdapter.FolderSync(Common.CreateFolderSyncRequest("0"));
                }
                catch (WebException exception)
                {
                    httpErrorCode = Common.GetErrorCodeFromException(exception);
                }

                Site.Assert.AreEqual("449", httpErrorCode, "[In MS-ASPROV Appendix A: Product Behavior] <2> Section 3.1.5.1: When the MS-ASProtocolVersion header is set to 12.1, the server sends an HTTP 449 response to request a Provision command from the client.");
            }
            else
            {
                // Call FolderSync command
                FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(Common.CreateFolderSyncRequest("0"));

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

                // Verify MS-ASCMD requirement: MS-ASCMD_R4912
                Site.CaptureRequirementIfAreEqual <int>(
                    144,
                    int.Parse(folderSyncResponse.ResponseData.Status),
                    4912,
                    @"[In Common Status Codes] [The meaning of the status value 144 is] The device's policy key is invalid.");
            }

            #endregion
        }
        /// <summary>
        /// Send string request of Provision command to the server and get the Provision response.
        /// </summary>
        /// <param name="provisionRequest">The string request of Provision command.</param>
        /// <returns>The response of Provision command.</returns>
        public ProvisionResponse SendProvisionStringRequest(string provisionRequest)
        {
            SendStringResponse provisionStringResponse = this.activeSyncClient.SendStringRequest(CommandName.Provision, null, provisionRequest);
            Site.Assert.IsNotNull(provisionStringResponse, "The SendStringRequest response returned from server should not be null.");

            // Convert the SendStringResponse to ProvisionResponse.
            ProvisionResponse provisionResponse = new ProvisionResponse
            {
                ResponseDataXML = provisionStringResponse.ResponseDataXML
            };
            provisionResponse.DeserializeResponseData();

            return provisionResponse;
        }
        public void MSASCMD_S12_TC01_Provision_DownloadPolicy()
        {
            #region User calls Provision command to download policies from server
            // Calls Provision command to download policies
            ProvisionRequest  provisionRequest  = TestSuiteBase.GenerateDefaultProvisionRequest();
            ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest);

            // Get policyKey, policyType and statusCode from server response
            string policyKey  = GetPolicyKeyFromResponse(provisionResponse);
            string policyType = provisionResponse.ResponseData.Policies.Policy.PolicyType;
            Response.ProvisionPoliciesPolicyData data = provisionResponse.ResponseData.Policies.Policy.Data;
            byte statusCode = provisionResponse.ResponseData.Status;
            #endregion

            #region Verify Requirements MS-ASCMD_R5026, MS-ASCMD_R4990, MS-ASCMD_R4992
            // If User calls Provision command to download policies successful, server will return policyKey, policyType, data and statusCode in response, then MS-ASCMD_R5026, MS-ASCMD_R4990, MS-ASCMD_R4992 are verified.
            // The policy settings with the format specified in PolicyType element, are contained in Data element of Provision command response.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5026");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5026
            Site.CaptureRequirementIfIsTrue(
                policyKey != null && policyType != null && data != null && statusCode == 1,
                5026,
                @"[In Downloading Policy Settings] [Provision sequence for downloading policy settings, order 1:] The server responds with the policy type, policy key, data, and status code.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4990
            Site.CaptureRequirementIfIsTrue(
                policyKey != null && policyType != null && data != null,
                4990,
                @"[In Downloading Policy Settings] The server then responds with the provision:PolicyType, provision:PolicyKey (as specified in [MS-ASPROV] section 2.2.2.41), and provision:Data ([MS-ASPROV] section 2.2.2.23) elements.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4992
            Site.CaptureRequirementIfIsTrue(
                policyType != null && data != null,
                4992,
                @"[In Downloading Policy Settings] The policy settings, in the format specified in the provision:PolicyType element, are contained in the provision:Data element.");
            #endregion

            #region User calls Provision command to acknowledge policies.

            // Set acknowledgeStatus value to 1, means accept the policy.
            string           acknowledgeStatus           = "1";
            ProvisionRequest provisionAcknowledgeRequest = TestSuiteBase.GenerateDefaultProvisionRequest();
            provisionAcknowledgeRequest.RequestData.Policies.Policy.PolicyKey = policyKey;
            provisionAcknowledgeRequest.RequestData.Policies.Policy.Status    = acknowledgeStatus;

            // Calls Provision command
            ProvisionResponse provisionAcknowledgeResponse = this.CMDAdapter.Provision(provisionAcknowledgeRequest);

            // Get policyKey, policyType and status code from server response
            policyKey  = GetPolicyKeyFromResponse(provisionAcknowledgeResponse);
            policyType = provisionAcknowledgeResponse.ResponseData.Policies.Policy.PolicyType;
            statusCode = provisionAcknowledgeResponse.ResponseData.Policies.Policy.Status;

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5028
            Site.CaptureRequirementIfIsTrue(
                policyKey != null && policyType != null && statusCode == 1,
                5028,
                @"[In Downloading Policy Settings] [Provision sequence for downloading policy settings, order 2:] The server responds with the policy type, policy key, and status code to indicate that the server recorded the client's acknowledgement.");
            #endregion
        }
        public void MSASPROV_S02_TC01_RemoteWipe()
        {
            #region Apply a unique DeviceType.
            // Switch the user credential to User1 to get user information.
            this.SwitchUser(this.User1Information, true);

            // Apply the unique DeviceType.
            this.DeviceType = string.Format("{0}{1}", "ASPROV", DateTime.Now.ToString("mmssfff"));
            this.PROVAdapter.ApplyDeviceType(this.DeviceType);
            this.CurrentUserInformation.UserName   = this.User1Information.UserName;
            this.CurrentUserInformation.UserDomain = this.User1Information.UserDomain;

            #endregion

            #region Acknowledge the policy setting and set the device status on server to be wipe pending
            this.AcknowledgeSecurityPolicySettings();

            // Set the device status on server to be wipe pending.
            string userEmail = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);

            bool dataWiped = PROVSUTControlAdapter.WipeData(this.SutComputerName, userEmail, this.User1Information.UserPassword, this.DeviceType);
            Site.Assert.IsTrue(dataWiped, "The data on the device with DeviceType {0} should be wiped successfully.", this.DeviceType);
            #endregion

            #region Perform an initial remote wipe
            // Send an empty Provision request to indicate a remote wipe operation on client.
            ProvisionRequest  emptyRequest      = new ProvisionRequest();
            ProvisionResponse provisionResponse = this.PROVAdapter.Provision(emptyRequest);

            Site.Assert.IsNotNull(provisionResponse, "If the Provision command executes successfully, the response from server should not be null.");
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R653
            // The RemoteWipe element is not null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                provisionResponse.ResponseData.RemoteWipe,
                653,
                @"[In Responding to an Initial Request] The RemoteWipe MUST only be included if a remote wipe has been requested for the client.");
            #endregion

            #region Perform a failure remote wipe acknowledgment
            // Set the remote wipe status to 2 to indicate a remote wipe failure on client.
            ProvisionRequest wipeRequest = new ProvisionRequest
            {
                RequestData =
                {
                    RemoteWipe = new Microsoft.Protocols.TestSuites.Common.Request.ProvisionRemoteWipe
                    {
                        Status = "2"
                    }
                }
            };

            provisionResponse = this.PROVAdapter.Provision(wipeRequest);

            if (Common.IsRequirementEnabled(1042, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    1,
                    provisionResponse.ResponseData.Status,
                    1042,
                    @"[In Appendix A: Product Behavior]  If the client reports failure, the implementation does return a value of 2 in the Status element [and a remote wipe directive]. (<4> Section 3.2.5.1.2.2:  In Exchange 2007 and Exchange 2010, if the client reports failure, the server returns a value of 1 in the Status element.)");
            }

            if (Common.IsRequirementEnabled(1048, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    2,
                    provisionResponse.ResponseData.Status,
                    1048,
                    @"[In Appendix A: Product Behavior] If the client reports failure, the implementation does return a value of 2 in the Status element [and a remote wipe directive]. (Exchange 2013 and above follow this behavior.)");
            }

            // Send an empty Provision request to indicate a remote wipe operation on client.
            provisionResponse = this.PROVAdapter.Provision(emptyRequest);
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R702
                // The RemoteWipe element is not null, so this requirement can be captured.
                Site.CaptureRequirementIfIsNotNull(
                    provisionResponse.ResponseData.RemoteWipe,
                    702,
                    @"[In Appendix B: Product Behavior] If the client reports failure, the implementation does return [a value of 2 in the Status element and] a remote wipe directive. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion

            #region Perform a successful remote wipe acknowledgment
            // Set the remote wipe status to 1 to indicate a successful wipe on client.
            wipeRequest.RequestData.RemoteWipe.Status = "1";
            ProvisionResponse wipeResponse = this.PROVAdapter.Provision(wipeRequest);

            if (Common.IsRequirementEnabled(1041, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    1,
                    wipeResponse.ResponseData.Status,
                    1041,
                    @"[In Appendix A: Product Behavior] If the client reports success, the implementation does return a value of 1 in the Status element (section 2.2.2.53.2). (<3> Section 3.2.5.1.2.2:  In Exchange 2007 and Exchange 2010, if the client reports success, the server returns a value of 1 in the Status element and a remote wipe directive.)");
            }

            if (Common.IsRequirementEnabled(1047, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    1,
                    wipeResponse.ResponseData.Status,
                    1047,
                    @"[In Appendix A: Product Behavior] If the client reports success, the implementation does return a value of 1 in the Status element (section 2.2.2.53.2). (Exchange 2013 and above follow this behavior.)");
            }

            // Record the provision confirmation mail for user1 to the item collection of User1.
            string       confirmationMailSubject = "Remote Device Wipe Confirmation";
            CreatedItems inboxItemForUser1       = Common.RecordCreatedItem(this.User1Information.InboxCollectionId, confirmationMailSubject);
            this.User1Information.UserCreatedItems.Add(inboxItemForUser1);
            CreatedItems sentItemForUser1 = Common.RecordCreatedItem(this.User1Information.SentItemsCollectionId, confirmationMailSubject);
            this.User1Information.UserCreatedItems.Add(sentItemForUser1);
            #endregion

            #region Remove the device from server and perform another initial remote wipe
            // Remove the device from the mobile list after wipe operation is successful.
            bool deviceRemoved = PROVSUTControlAdapter.RemoveDevice(this.SutComputerName, userEmail, this.User1Information.UserPassword, this.DeviceType);
            Site.Assert.IsTrue(deviceRemoved, "The device with DeviceType {0} should be removed successfully.", this.DeviceType);

            // Send an empty Provision request when the client is not requested for a remote wipe.
            provisionResponse = this.PROVAdapter.Provision(emptyRequest);
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R654
            // The RemoteWipe element is null, so this requirement can be captured.
            Site.CaptureRequirementIfIsNull(
                provisionResponse.ResponseData.RemoteWipe,
                654,
                @"[In Responding to an Initial Request] Otherwise [if a remote wipe has not been requested for the client], it [RemoteWipe] MUST be omitted");
            #endregion
        }
        /// <summary>
        /// Get PolicyKey from Provision Response
        /// </summary>
        /// <param name="response">Provision Response</param>
        /// <returns>Policy Key, if the response doesn't contain the PolicyKey, returns null</returns>
        private static string GetPolicyKeyFromResponse(ProvisionResponse response)
        {
            if (null != response.ResponseData.Policies)
            {
                Response.ProvisionPoliciesPolicy policyInResponse = response.ResponseData.Policies.Policy;
                if (policyInResponse != null)
                {
                    return policyInResponse.PolicyKey;
                }
            }

            return null;
        }
        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
        }
        /// <summary>
        /// This method is used to verify the Provision response related requirements.
        /// </summary>
        /// <param name="provisionResponse">Provision command response.</param>
        private void VerifyProvisionCommand(ProvisionResponse provisionResponse)
        {
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "The schema validation result should be true.");
            Site.Assert.IsNotNull(provisionResponse.ResponseData, "The Provision element should not be null.");

            if (provisionResponse.ResponseData.Policies != null && provisionResponse.ResponseData.Policies.Policy != null)
            {
                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4996");

                // If the schema validation result is true and Policy is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    4996,
                    @"[In Downloading Policy Settings] The response from the server contains provision:PolicyType, provision:PolicyKey, and provision:Status elements.");
            }
        }
        public void MSASPROV_S02_TC02_AccountOnlyRemoteWipe()
        {
            Site.Assume.AreEqual <string>("16.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The AccountOnlyRemoteWipe element is supported when the ActiveSyncProtocolVersion is 16.1.");

            #region Apply a unique DeviceType.
            // Switch the user credential to User1 to get user information.
            this.SwitchUser(this.User1Information, true);

            // Apply the unique DeviceType.
            this.DeviceType = string.Format("{0}{1}", "ASPROV", DateTime.Now.ToString("mmssfff"));
            this.PROVAdapter.ApplyDeviceType(this.DeviceType);
            this.CurrentUserInformation.UserName   = this.User1Information.UserName;
            this.CurrentUserInformation.UserDomain = this.User1Information.UserDomain;
            #endregion

            #region Acknowledge the policy setting and set the device status on server to be wipe pending
            this.AcknowledgeSecurityPolicySettings();

            // Set the device status on server to be wipe pending.
            string userEmail = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);

            bool dataWiped = PROVSUTControlAdapter.AccountOnlyWipeData(this.SutComputerName, userEmail, this.User1Information.UserPassword, this.DeviceType);
            Site.Assert.IsTrue(dataWiped, "The data on the device with DeviceType {0} should be wiped successfully.", this.DeviceType);
            #endregion

            #region Perform an initial account only remote wipe
            // Send an empty Provision request to indicate an account only remote wipe operation on client.
            ProvisionRequest  emptyRequest      = new ProvisionRequest();
            ProvisionResponse provisionResponse = this.PROVAdapter.Provision(emptyRequest);

            Site.Assert.IsNotNull(provisionResponse, "If the Provision command executes successfully, the response from server should not be null.");
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R66613
                // The AccountOnlyRemoteWipe element is not null, so this requirement can be captured.
                Site.CaptureRequirementIfIsNotNull(
                    provisionResponse.ResponseData.AccountOnlyRemoteWipe,
                    66613,
                    @"[In Appendix B: Product Behavior] The [RemoteWipe or] AccountOnlyRemoteWipe MUST only be included if [a remote wipe or] an account only remote wipe has been requested for the client. (Exchange 2019 follow this behavior.)");
            }
            #endregion

            #region Perform a failure account only remote wipe acknowledgment
            // Set the account only remote wipe status to 2 to indicate an account only remote wipe failure on client.
            ProvisionRequest wipeRequest = new ProvisionRequest
            {
                RequestData =
                {
                    AccountOnlyRemoteWipe = new Microsoft.Protocols.TestSuites.Common.Request.ProvisionAccountOnlyRemoteWipe
                    {
                        Status            = 2
                    }
                }
            };

            provisionResponse = this.PROVAdapter.Provision(wipeRequest);

            if (Common.IsRequirementEnabled(66610, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    2,
                    provisionResponse.ResponseData.Status,
                    66610,
                    @"[In Appendix B: Product Behavior]  If the client reports failure, the server SHOULD return a value of 2 in the Status element[ and an account only remote wipe directive]. (Exchange 2019 follow this behavior.)");
            }

            // Send an empty Provision request to indicate an account only remote wipe operation on client.
            provisionResponse = this.PROVAdapter.Provision(emptyRequest);
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R66611
                // The AccountOnlyRemoteWipe element is not null, so this requirement can be captured.
                Site.CaptureRequirementIfIsNotNull(
                    provisionResponse.ResponseData.AccountOnlyRemoteWipe,
                    66611,
                    @"[In Appendix B: Product Behavior] If the client reports failure, the server SHOULD return [a value of 2 in the Status element and ]an account only remote wipe directive. (Exchange 2019 follow this behavior.)");
            }
            #endregion

            #region Perform a successful account only remote wipe acknowledgment
            // Set the account only remote wipe status to 1 to indicate a successful wipe on client.
            wipeRequest.RequestData.AccountOnlyRemoteWipe.Status = 1;
            ProvisionResponse wipeResponse = this.PROVAdapter.Provision(wipeRequest);

            if (Common.IsRequirementEnabled(66609, this.Site))
            {
                this.Site.CaptureRequirementIfAreEqual <byte>(
                    1,
                    wipeResponse.ResponseData.Status,
                    66609,
                    @"[In Appendix B: Product Behavior] If the client reports success, the server SHOULD return a value of 1 in the Status element (section 2.2.2.54.2). (Exchange 2019 follow this behavior.)");
            }

            // Record the provision confirmation mail for user1 to the item collection of User1.
            string       confirmationMailSubject = "Remote Device Wipe Confirmation";
            CreatedItems inboxItemForUser1       = Common.RecordCreatedItem(this.User1Information.InboxCollectionId, confirmationMailSubject);
            this.User1Information.UserCreatedItems.Add(inboxItemForUser1);
            CreatedItems sentItemForUser1 = Common.RecordCreatedItem(this.User1Information.SentItemsCollectionId, confirmationMailSubject);
            this.User1Information.UserCreatedItems.Add(sentItemForUser1);
            #endregion

            #region Remove the device from server and perform another initial account only remote wipe
            // Remove the device from the mobile list after wipe operation is successful.
            bool deviceRemoved = PROVSUTControlAdapter.RemoveDevice(this.SutComputerName, userEmail, this.User1Information.UserPassword, this.DeviceType);
            Site.Assert.IsTrue(deviceRemoved, "The device with DeviceType {0} should be removed successfully.", this.DeviceType);

            // Send an empty Provision request when the client is not requested for an account only remote wipe.
            provisionResponse = this.PROVAdapter.Provision(emptyRequest);
            Site.Assert.AreEqual <byte>(1, provisionResponse.ResponseData.Status, "The server should return status code 1 to indicate a success.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R66615
                // The AccountOnlyRemoteWipe element is null, so this requirement can be captured.
                Site.CaptureRequirementIfIsNull(
                    provisionResponse.ResponseData.AccountOnlyRemoteWipe,
                    66615,
                    @"[In Appendix B: Product Behavior] Otherwise [if an account only remote wipe has not been requested for the client], it [Account Only RemoteWipe] MUST be omitted. (Exchange 2019 follow this behavior.)");
            }
            #endregion
        }
        /// <summary>
        /// Verify child elements of EASProvisionDoc element.
        /// </summary>
        /// <param name="provisionResponse">Provision response</param>
        private void VerifyEASProvisionDocElement(ProvisionResponse provisionResponse)
        {
            // Get policy setting of provision command response.
            Dictionary<string, string> policiesSetting = AdapterHelper.GetPoliciesFromProvisionResponse(provisionResponse);

            if (policiesSetting.ContainsKey("AllowBluetooth"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R70");

                // Verify MS-ASPROV requirement: MS-ASPROV_R70
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    70,
                    @"[In AllowBluetooth] The AllowBluetooth element is an optional child element of type unsignedByte ([MS-ASDTYPE] section 2.7) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R71
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    71,
                    @"[In AllowBluetooth] The AllowBluetooth element cannot have child elements.");

                this.VerifyUnsignedByteStructure(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.AllowBluetooth);
            }

            if (policiesSetting.ContainsKey("AllowBrowser"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R80");

                // Verify MS-ASPROV requirement: MS-ASPROV_R80
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    80,
                    @"[In AllowBrowser] The AllowBrowser element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R81
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    81,
                    @"[In AllowBrowser] The AllowBrowser element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowCamera"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R85");

                // Verify MS-ASPROV requirement: MS-ASPROV_R85
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    85,
                    @"[In AllowCamera] The AllowCamera element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R86
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    86,
                    @"[In AllowCamera] The AllowCamera element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowConsumerEmail"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R92");

                // Verify MS-ASPROV requirement: MS-ASPROV_R92
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    92,
                    @"[In AllowConsumerEmail] The AllowConsumerEmail element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R93
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    93,
                    @"[In AllowConsumerEmail] The AllowConsumerEmail element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowDesktopSync"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R97");

                // Verify MS-ASPROV requirement: MS-ASPROV_R97
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    97,
                    @"[In AllowDesktopSync] The AllowDesktopSync element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R98
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    98,
                    @"[In AllowDesktopSync] The AllowDesktopSync element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowHTMLEmail"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R104");

                // Verify MS-ASPROV requirement: MS-ASPROV_R104
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    104,
                    @"[In AllowHTMLEmail] The AllowHTMLEmail element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R105
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    105,
                    @"[In AllowHTMLEmail] The AllowHTMLEmail element cannot have child elements.");

                this.VerifyBooleanStructure();

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R106
                // Since MS-ASDTYPE_R5 has been verified in VerifyBooleanStructure, so this requirement can be captured.
                Site.CaptureRequirement(
                    106,
                    @"[In AllowHTMLEmail] Valid values [0,1] for AllowHTMLEmail are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("AllowInternetSharing"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R109");

                // Verify MS-ASPROV requirement: MS-ASPROV_R109
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    109,
                    @"[In AllowInternetSharing] The AllowInternetSharing element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R110
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    110,
                    @"[In AllowInternetSharing] The AllowInternetSharing element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowIrDA"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R116");

                // Verify MS-ASPROV requirement: MS-ASPROV_R116
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    116,
                    @"[In AllowIrDA] The AllowIrDA element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R117
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    117,
                    @"[In AllowIrDA] The AllowIrDA element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowPOPIMAPEmail"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R123");

                // Verify MS-ASPROV requirement: MS-ASPROV_R123
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    123,
                    @"[In AllowPOPIMAPEmail] The AllowPOPIMAPEmail element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R124
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    124,
                    @"[In AllowPOPIMAPEmail] The AllowPOPIMAPEmail element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowRemoteDesktop"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R128");

                // Verify MS-ASPROV requirement: MS-ASPROV_R128
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    128,
                    @"[In AllowRemoteDesktop] The AllowRemoteDesktop element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R129
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    129,
                    @"[In AllowRemoteDesktop] The AllowRemoteDesktop element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowSimpleDevicePassword"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R135");

                // Verify MS-ASPROV requirement: MS-ASPROV_R135
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    135,
                    @"[In AllowSimpleDevicePassword] The AllowSimpleDevicePassword element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R137
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    137,
                    @"[In AllowSimpleDevicePassword] The AllowSimpleDevicePassword element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowSMIMEEncryptionAlgorithmNegotiation"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R143");

                // Verify MS-ASPROV requirement: MS-ASPROV_R143
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    143,
                    @"[In AllowSMIMEEncryptionAlgorithmNegotiation] The AllowSMIMEEncryptionAlgorithmNegotation element is an optional child element of type integer ([MS-ASDTYPE] section 2.5) of the EASProvisionDoc element (section 2.2.2.12).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R144
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    144,
                    @"[In AllowSMIMEEncryptionAlgorithmNegotiation] The AllowSMIMEEncryptionAlgorithmNegotation element cannot have child elements.");

                this.VerifyIntegerStructure();
            }

            if (policiesSetting.ContainsKey("AllowSMIMESoftCerts"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R149");

                // Verify MS-ASPROV requirement: MS-ASPROV_R149
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    149,
                    @"[In AllowSMIMESoftCerts] The AllowSMIMESoftCerts element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R150
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    150,
                    @"[In AllowSMIMESoftCerts] The AllowSMIMESoftCerts element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowStorageCard"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R154");

                // Verify MS-ASPROV requirement: MS-ASPROV_R154
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    154,
                    @"[In AllowStorageCard] The AllowStorageCard element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R155
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    155,
                    @"[In AllowStorageCard] The AllowStorageCard element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowTextMessaging"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R160");

                // Verify MS-ASPROV requirement: MS-ASPROV_R160
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    160,
                    @"[In AllowTextMessaging] The AllowTextMessaging element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R161
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    161,
                    @"[In AllowTextMessaging] The AllowTextMessaging element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowUnsignedApplications"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R166");

                // Verify MS-ASPROV requirement: MS-ASPROV_R166
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    166,
                    @"[In AllowUnsignedApplications] The AllowUnsignedApplications element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R167
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    167,
                    @"[In AllowUnsignedApplications] The AllowUnsignedApplications element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowUnsignedInstallationPackages"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R171");

                // Verify MS-ASPROV requirement: MS-ASPROV_R171
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    171,
                    @"[In AllowUnsignedInstallationPackages] The AllowUnsignedInstallationPackages element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R172
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    172,
                    @"[In AllowUnsignedInstallationPackages] The AllowUnsignedInstallationPackages element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AllowWiFi"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R176");

                // Verify MS-ASPROV requirement: MS-ASPROV_R176
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    176,
                    @"[In AllowWifi] The AllowWifi element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R177
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    177,
                    @"[In AllowWifi] The AllowWifi element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("AlphanumericDevicePasswordRequired"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R182");

                // Verify MS-ASPROV requirement: MS-ASPROV_R182
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    182,
                    @"[In AlphanumericDevicePasswordRequired] The AlphanumericDevicePasswordRequired element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R183
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    183,
                    @"[In AlphanumericDevicePasswordRequired] The AlphanumericDevicePasswordRequired element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("ApprovedApplicationList"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R194");

                // Verify MS-ASPROV requirement: MS-ASPROV_R194
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    194,
                    @"[In ApprovedApplicationList] The ApprovedApplicationList element is an optional container ([MS-ASDTYPE] section 2.2) element.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R195
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    195,
                    @"[In ApprovedApplicationList] It [ApprovedApplicationList element element] is a child of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R199
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    199,
                    @"[In ApprovedApplicationList] A command response has a maximum of one ApprovedApplicationList element per EASProvisionDoc element.");

                this.VerifyContainerStructure();

                if (provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.ApprovedApplicationList.Length != 0)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R202");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R202
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        202,
                        @"[In ApprovedApplicationList] The ApprovedApplicationList element has only the following child element: Hash (section 2.2.2.28): This element is optional.");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R236
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        236,
                        @"[In Hash] The Hash element is an optional child element of type string ([MS-ASDTYPE] section 2.6) of the ApprovedApplicationList element (section 2.2.2.21).");
                }
            }

            if (policiesSetting.ContainsKey("AttachmentsEnabled"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R203");

                // Verify MS-ASPROV requirement: MS-ASPROV_R203
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    203,
                    @"[In AttachmentsEnabled] The AttachmentsEnabled element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R204
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    204,
                    @"[In AttachmentsEnabled] The AttachmentsEnabled element cannot have child elements.");

                this.VerifyBooleanStructure();

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R205
                // Since MS-ASDTYPE_R5 has been verified in VerifyBooleanStructure, so this requirement can be captured.
                Site.CaptureRequirement(
                    205,
                    @"[In AttachmentsEnabled] Valid values [0,1] for AttachmentsEnabled are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("DevicePasswordEnabled"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R211");

                // Verify MS-ASPROV requirement: MS-ASPROV_R211
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    211,
                    @"[In DevicePasswordEnabled] The DevicePasswordEnabled element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R212
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    212,
                    @"[In DevicePasswordEnabled] The DevicePasswordEnabled element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("DevicePasswordExpiration"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R216");

                // Verify MS-ASPROV requirement: MS-ASPROV_R216
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    216,
                    @"[In DevicePasswordExpiration] The DevicePasswordExpiration element is an optional child element of type unsignedIntOrEmpty (section 2.2.3.3) of the EASProvisionDoc element, as specified in section 2.2.2.27.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R218
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    218,
                    @"[In DevicePasswordExpiration] The DevicePasswordExpiration element cannot have child elements.");

                if (string.IsNullOrEmpty(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.DevicePasswordExpiration))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R674");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R674
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        674,
                        @"[In unsignedIntOrEmpty Simple Type] The unsignedIntOrEmpty simple type represents a value that can either be [an xs:unsignedInt type, as specified in [XMLSCHEMA2/2] section 3.3.22, or] an empty value.
<xs:simpleType name=""unsignedIntOrEmpty"">
  <xs:union memberTypes=""xs:unsignedInt EmptyVal""/>
</xs:simpleType>");
                }
                else
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R677");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R677
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        677,
                        @"[In unsignedIntOrEmpty Simple Type] The unsignedIntOrEmpty simple type represents a value that can either be an xs:unsignedInt type, as specified in [XMLSCHEMA2/2] section 3.3.22, [or an empty value].
<xs:simpleType name=""unsignedIntOrEmpty"">
  <xs:union memberTypes=""xs:unsignedInt EmptyVal""/>
</xs:simpleType>");
                }
            }

            if (policiesSetting.ContainsKey("DevicePasswordHistory"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R224");

                // Verify MS-ASPROV requirement: MS-ASPROV_R224
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    224,
                    @"[In DevicePasswordHistory] The DevicePasswordHistory element is an optional child element of type unsignedInt of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R225
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    225,
                    @"[In DevicePasswordHistory] The DevicePasswordHistory element cannot have child elements.");
            }

            if (policiesSetting.ContainsKey("MaxAttachmentSize"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R240");

                // Verify MS-ASPROV requirement: MS-ASPROV_R240
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    240,
                    @"[In MaxAttachmentSize] The MaxAttachmentSize element is an optional child element of type unsignedIntOrEmpty (section 2.2.3.3) of the EASProvisionDoc element, as specified in section 2.2.2.27.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R241
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    241,
                    @"[In MaxAttachmentSize] The EASProvisionDoc element has at most one instance of the MaxAttachmentSize element.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R242
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    242,
                    @"[In MaxAttachmentSize] The MaxAttachmentSize element cannot have child elements.");
            }

            if (policiesSetting.ContainsKey("MaxCalendarAgeFilter"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R243");

                // Verify MS-ASPROV requirement: MS-ASPROV_R243
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    243,
                    @"[In MaxCalendarAgeFilter] The MaxCalendarAgeFilter element is an optional child element of type unsignedInt of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R244
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    244,
                    @"[In MaxCalendarAgeFilter] The MaxCalendarAgeFilter element cannot have child elements.");

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R245");
                Common.VerifyActualValues("MaxCalendarAgeFilter", new string[] { "0", "4", "5", "6", "7" }, provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxCalendarAgeFilter.ToString(), Site);

                // Verify MS-ASPROV requirement: MS-ASPROV_R245
                // The value of MaxCalendarAgeFilter element is one of the valid values, so this requirement can be captured.
                Site.CaptureRequirement(
                    245,
                    @"[In MaxCalendarAgeFilter] Valid values [0,4,5,6,7] for MaxCalendarAgeFilter are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("MaxDevicePasswordFailedAttempts"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R251");

                // Verify MS-ASPROV requirement: MS-ASPROV_R251
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    251,
                    @"[In MaxDevicePasswordFailedAttempts] The MaxDevicePasswordFailedAttempts element is an optional child element of type unsignedByteOrEmpty (section 2.2.3.2) of the EASProvisionDoc element, as specified in section 2.2.2.27.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R252
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    252,
                    @"[In MaxDevicePasswordFailedAttempts] The MaxDevicePasswordFailedAttempts element cannot have child elements.");

                if (string.IsNullOrEmpty(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxDevicePasswordFailedAttempts))
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R673");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R673
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        673,
                        @"[In unsignedByteOrEmpty Simple Type] The unsignedByteOrEmpty simple type represents a value that can either be an [xs:unsignedByte type, as specified in [XMLSCHEMA2/2] section 3.3.24, or] an empty value.
<xs:simpleType name=""unsignedByteOrEmpty"">
  <xs:union memberTypes=""xs:unsignedByte EmptyVal""/>
</xs:simpleType>");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R672
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        672,
                        @"[In EmptyVal Simple Type] The EmptyVal simple type represents an empty value.
<xs:simpleType name=""EmptyVal"">
  <xs:restriction base=""xs:string"">
    <xs:maxLength value=""0""/>
  </xs:restriction>
</xs:simpleType>");
                }
                else
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R676");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R676
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        676,
                        @"[In unsignedByteOrEmpty Simple Type] The unsignedByteOrEmpty simple type represents a value that can either be an xs:unsignedByte type, as specified in [XMLSCHEMA2/2] section 3.3.24, [or an empty value].
<xs:simpleType name=""unsignedByteOrEmpty"">
  <xs:union memberTypes=""xs:unsignedByte EmptyVal""/>
</xs:simpleType>");
                }
            }

            if (policiesSetting.ContainsKey("MaxEmailAgeFilter"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R255");

                // Verify MS-ASPROV requirement: MS-ASPROV_R255
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    255,
                    @"[In MaxEmailAgeFilter] The MaxEmailAgeFilter element is an optional child element of type unsignedInt of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R256
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    256,
                    @"[In MaxEmailAgeFilter] The MaxEmailAgeFilter element cannot have child elements.");

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

                Common.VerifyActualValues("MaxEmailAgeFilter", new string[] { "0", "1", "2", "3", "4", "5" }, provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxEmailAgeFilter.ToString(), Site);

                // Verify MS-ASPROV requirement: MS-ASPROV_R257
                // The value of MaxEmailAgeFilter element is one of the valid values, so this requirement can be captured.
                Site.CaptureRequirement(
                    257,
                    @"[In MaxEmailAgeFilter] Valid values [0,1,2,3,4,5] are listed in the following table and represent the maximum allowable number of days to sync email.");
            }

            if (policiesSetting.ContainsKey("MaxEmailBodyTruncationSize"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R265");

                // Verify MS-ASPROV requirement: MS-ASPROV_R265
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    265,
                    @"[In MaxEmailBodyTruncationSize] The MaxEmailBodyTruncationSize element cannot have child elements.");

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R266, the value of MaxEmailBodyTruncationSize element is {0}.", provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxEmailBodyTruncationSize);

                // Verify MS-ASPROV requirement: MS-ASPROV_R266
                bool isVerifiedR266 = Convert.ToInt32(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxEmailBodyTruncationSize) >= -1;

                Site.CaptureRequirementIfIsTrue(
                    isVerifiedR266,
                    266,
                    @"[In MaxEmailBodyTruncationSize] Valid values [-1, 0, >0] for the MaxEmailBodyTruncationSize element are an integer ([MS-ASDTYPE] section 2.5) of one of the values or ranges listed in the following table.");

                this.VerifyIntegerStructure();
            }

            if (policiesSetting.ContainsKey("MaxEmailHTMLBodyTruncationSize"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R271");

                // Verify MS-ASPROV requirement: MS-ASPROV_R271
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    271,
                    @"[In MaxEmailHTMLBodyTruncationSize] The MaxEmailHTMLBodyTruncationSize element cannot have child elements.");

                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R272, the value of MaxEmailHTMLBodyTruncationSize element is {0}.", provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxEmailHTMLBodyTruncationSize);

                // Verify MS-ASPROV requirement: MS-ASPROV_R272
                bool isVerifiedR272 = Convert.ToInt32(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MaxEmailHTMLBodyTruncationSize) >= -1;

                Site.CaptureRequirementIfIsTrue(
                    isVerifiedR272,
                    272,
                    @"[In MaxEmailHTMLBodyTruncationSize] Valid values [-1, 0, >0] for the MaxEmailHTMLBodyTruncationSize element are an integer ([MS-ASDTYPE] section 2.5) of one of the values or ranges listed in the following table.");

                this.VerifyIntegerStructure();
            }

            if (policiesSetting.ContainsKey("MaxInactivityTimeDeviceLock"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R276");

                // Verify MS-ASPROV requirement: MS-ASPROV_R276
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    276,
                    @"[In MaxInactivityTimeDeviceLock] The MaxInactivityTimeDeviceLock element is an optional child element of type unsignedIntOrEmpty (section 2.2.3.3) of the EASProvisionDoc element, as specified in section 2.2.2.27.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R277
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    277,
                    @"[In MaxInactivityTimeDeviceLock] The MaxInactivityTimeDeviceLock element cannot have child elements.");
            }

            if (policiesSetting.ContainsKey("MinDevicePasswordComplexCharacters"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R280");

                // Verify MS-ASPROV requirement: MS-ASPROV_R280
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    280,
                    @"[In MinDevicePasswordComplexCharacters] The MinDevicePasswordComplexCharacters element is an optional child element of type unsignedByte ([MS-ASDTYPE] section 2.7) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R281
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    281,
                    @"[In MinDevicePasswordComplexCharacters] The MinDevicePasswordComplexCharacters element cannot have child elements.");

                this.VerifyUnsignedByteStructure(provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.MinDevicePasswordComplexCharacters);
            }

            if (policiesSetting.ContainsKey("MinDevicePasswordLength"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R286");

                // Verify MS-ASPROV requirement: MS-ASPROV_R286
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    286,
                    @"[In MinDevicePasswordLength] The MinDevicePasswordLength element is an optional child element of type unsignedByteOrEmpty (section 2.2.3.2) of the EASProvisionDoc element, as specified in section 2.2.2.27.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R287
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    287,
                    @"[In MinDevicePasswordLength] The MinDevicePasswordLength element cannot have child elements.");
            }

            if (policiesSetting.ContainsKey("PasswordRecoveryEnabled"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R291");

                // Verify MS-ASPROV requirement: MS-ASPROV_R291
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    291,
                    @"[In PasswordRecoveryEnabled] The PasswordRecoveryEnabled element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R292
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    292,
                    @"[In PasswordRecoveryEnabled] The PasswordRecoveryEnabled element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("RequireDeviceEncryption"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R326");

                // Verify MS-ASPROV requirement: MS-ASPROV_R326
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    326,
                    @"[In RequireDeviceEncryption] The RequireDeviceEncryption element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R327
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    327,
                    @"[In RequireDeviceEncryption] The RequireDeviceEncryption element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("RequireEncryptedSMIMEMessages"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R331");

                // Verify MS-ASPROV requirement: MS-ASPROV_R331
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    331,
                    @"[In RequireEncryptedSMIMEMessages] The RequireEncryptedSMIMEMessages element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R327
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    332,
                    @"[In RequireEncryptedSMIMEMessages] The RequireEncryptedSMIMEMessages element cannot have child elements.");

                this.VerifyBooleanStructure();

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R333
                // Since MS-ASDTYPE_R5 has been verified in VerifyBooleanStructure, so this requirement can be captured.
                Site.CaptureRequirement(
                    333,
                    @"[In RequireEncryptedSMIMEMessages] Valid values [0,1] for RequireEncryptedSMIMEMessages are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("RequireEncryptionSMIMEAlgorithm"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R336");

                // Verify MS-ASPROV requirement: MS-ASPROV_R336
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    336,
                    @"[In RequireEncryptionSMIMEAlgorithm] The RequireEncryptionSMIMEAlgorithm element is an optional child element of type integer ([MS-ASDTYPE] section 2.5) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R337
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    337,
                    @"[In RequireEncryptionSMIMEAlgorithm] The RequireEncryptionSMIMEAlgorithm element cannot have child elements.");

                this.VerifyIntegerStructure();

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

                Common.VerifyActualValues("RequireEncryptionSMIMEAlgorithm", new string[] { "0", "1", "2", "3", "4" }, provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.RequireEncryptionSMIMEAlgorithm.ToString(), Site);

                // Verify MS-ASPROV requirement: MS-ASPROV_R338
                // The actual value is one of the valid values, so this requirement can be captured.
                Site.CaptureRequirement(
                    338,
                    @"[In RequireEncryptionSMIMEAlgorithm] Valid values [0,1,2,3,4] for RequireEncryptionSMIMEAlgorithm are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("RequireManualSyncWhenRoaming"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R344");

                // Verify MS-ASPROV requirement: MS-ASPROV_R344
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    344,
                    @"[In RequireManualSyncWhenRoaming] The RequireManualSyncWhenRoaming element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R345
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    345,
                    @"[In RequireManualSyncWhenRoaming] The RequireManualSyncWhenRoaming element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("RequireSignedSMIMEAlgorithm"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R349");

                // Verify MS-ASPROV requirement: MS-ASPROV_R349
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    349,
                    @"[In RequireSignedSMIMEAlgorithm] The RequireSignedSMIMEAlgorithm element is an optional child element of type integer ([MS-ASDTYPE] section 2.5) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R350
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    350,
                    @"[In RequireSignedSMIMEAlgorithm] The RequireSignedSMIMEAlgorithm element cannot have child elements.");

                this.VerifyIntegerStructure();

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

                Common.VerifyActualValues("RequireSignedSMIMEAlgorithm", new string[] { "0", "1" }, provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.RequireSignedSMIMEAlgorithm.ToString(), Site);

                // Verify MS-ASPROV requirement: MS-ASPROV_R351
                // The value of RequireSignedSMIMEAlgorithm element is one of valid values, so this requirement can be captured.
                Site.CaptureRequirement(
                    351,
                    @"[In RequireSignedSMIMEAlgorithm] Valid values [0,1] for RequireSignedSMIMEAlgorithm are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("RequireSignedSMIMEMessages"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R354");

                // Verify MS-ASPROV requirement: MS-ASPROV_R354
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    354,
                    @"[In RequireSignedSMIMEMessages] The RequireSignedSMIMEMessages element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R355
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    355,
                    @"[In RequireSignedSMIMEMessages] The RequireSignedSMIMEMessages element cannot have child elements.");

                this.VerifyBooleanStructure();

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R356
                // Since MS-ASDTYPE_R5 has been verified in VerifyBooleanStructure, so this requirement can be captured.
                Site.CaptureRequirement(
                    356,
                    @"[In RequireSignedSMIMEMessages] Valid values [0,1] for RequireSignedSMIMEMessages are listed in the following table.");
            }

            if (policiesSetting.ContainsKey("RequireStorageCardEncryption"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R359");

                // Verify MS-ASPROV requirement: MS-ASPROV_R359
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    359,
                    @"[In RequireStorageCardEncryption] The RequireStorageCardEncryption element is an optional child element of type boolean ([MS-ASDTYPE] section 2.1) of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R360
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    360,
                    @"[In RequireStorageCardEncryption] The RequireStorageCardEncryption element cannot have child elements.");

                this.VerifyBooleanStructure();
            }

            if (policiesSetting.ContainsKey("UnapprovedInROMApplicationList"))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R404");

                // Verify MS-ASPROV requirement: MS-ASPROV_R404
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    404,
                    @"[In UnapprovedInROMApplicationList] The UnapprovedInROMApplicationList element is an optional container ([MS-ASDTYPE] section 2.2) element.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R405
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    405,
                    @"[In UnapprovedInROMApplicationList] It [UnapprovedInROMApplicationList element] is a child of the EASProvisionDoc element (section 2.2.2.27).");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R408
                // The schema has been validated, so this requirement can be captured.
                Site.CaptureRequirement(
                    408,
                    @"[In UnapprovedInROMApplicationList] A command response has a maximum of one UnapprovedInROMApplicationList element per EASProvisionDoc element.");

                this.VerifyContainerStructure();

                if (provisionResponse.ResponseData.Policies.Policy.Data.EASProvisionDoc.UnapprovedInROMApplicationList.Length != 0)
                {
                    // Add the debug information
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASPROV_R189");

                    // Verify MS-ASPROV requirement: MS-ASPROV_R189
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        189,
                        @"[In ApplicationName] The ApplicationName element is an optional child element of type string ([MS-ASDTYPE] section 2.6) of the UnapprovedInROMApplicationList element (section 2.2.2.54).");

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

                    // Verify MS-ASPROV requirement: MS-ASPROV_R409
                    // The schema has been validated, so this requirement can be captured.
                    Site.CaptureRequirement(
                        409,
                        @"[In UnapprovedInROMApplicationList] The UnapprovedInROMApplicationList element has only the following child element: ApplicationName (section 2.2.2.20): This element is optional.");
                }
            }
        }
        public void MSASPROV_S03_TC03_VerifyProvisionStatus2()
        {
            #region Create a Provision request with syntax error.
            ProvisionRequest provisionRequest      = Common.CreateProvisionRequest(null, new Request.ProvisionPolicies(), null);
            Request.ProvisionPoliciesPolicy policy = new Request.ProvisionPoliciesPolicy
            {
                PolicyType = "MS-EAS-Provisioning-WBXML"
            };

            // The format in which the policy settings are to be provided to the client device.
            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "14.1" ||
                Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "16.0" ||
                Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) == "16.1")
            {
                // Configure the DeviceInformation.
                Request.DeviceInformation    deviceInfomation     = new Request.DeviceInformation();
                Request.DeviceInformationSet deviceInformationSet = new Request.DeviceInformationSet
                {
                    Model = "ASPROVTest"
                };
                deviceInfomation.Set = deviceInformationSet;
                provisionRequest.RequestData.DeviceInformation = deviceInfomation;
            }

            provisionRequest.RequestData.Policies.Policy = policy;
            string requestBody = provisionRequest.GetRequestDataSerializedXML();
            requestBody = requestBody.Replace(@"<Policies>", string.Empty);
            requestBody = requestBody.Replace(@"</Policies>", string.Empty);
            #endregion

            #region Call Provision command and get the Status of response.
            ProvisionResponse provisionResponse = this.PROVAdapter.SendProvisionStringRequest(requestBody);
            byte provisionStatus = provisionResponse.ResponseData.Status;

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R395
            // The Status of Provision element is 2, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                2,
                provisionStatus,
                395,
                @"[In Status (Provision)] Value 2 means Protocol error.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R679
            // The Status of Provision element is 2, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                2,
                provisionStatus,
                679,
                @"[In Provision Command Errors] [The meaning of status value] 2 [is] Protocol error.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R450
            // The Status of Provision element is 2, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                2,
                provisionStatus,
                450,
                @"[In Provision Command Errors] [The cause of status value 2 is] Syntax error in the Provision command request.");

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

            // Verify MS-ASPROV requirement: MS-ASPROV_R497
            // The Status of Provision element is 2, so this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <byte>(
                2,
                provisionStatus,
                497,
                @"[In Provision Command Errors] [When the scope is Global], [the cause of status value 2 is] Syntax error in the Provision command request.");

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R697
                // Status 2 is returned when there is syntax error in the Provision command request, so this requirement can be captured.
                Site.CaptureRequirement(
                    697,
                    @"[In Appendix B: Product Behavior] If the level of compliance does not meet the server's requirements, the implementation does return an appropriate value in the Status (section 2.2.2.53.2) element. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion
        }