Microsoft.Protocols.TestSuites.MS_ASPROV.MS_ASPROVAdapter.VerifyProvisionCommandRequirements C# (CSharp) Method

VerifyProvisionCommandRequirements() private method

Verify Provision command requirements.
private VerifyProvisionCommandRequirements ( ProvisionResponse provisionResponse ) : void
provisionResponse ProvisionResponse Provision response
return void
        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();
        }