Esempio n. 1
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_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
        }
        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")
            {
                // 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
        }
        /// <summary>
        /// Generate one device information.
        /// </summary>
        /// <returns>Device information.</returns>
        protected static Request.DeviceInformation GenerateDeviceInformation()
        {
            Request.DeviceInformationSet deviceInfoSet = new Request.DeviceInformationSet
            {
                FriendlyName = "test device",
                UserAgent = "test user agent",
                IMEI = "123456789012345",
                MobileOperator = "Microsoft",
                Model = "test model",
                OS = "windows7",
                OSLanguage = "en-us",
                PhoneNumber = "88888888888"
            };

            Request.DeviceInformation deviceInfo = new Request.DeviceInformation { Set = deviceInfoSet };

            return deviceInfo;
        }
        /// <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;
        }