예제 #1
0
        /// <summary>
        /// Synchronizes the collection hierarchy
        /// </summary>
        /// <param name="folderSyncRequest">FolderSync command request.</param>
        /// <returns>The FolderSync response which is returned from the server</returns>
        public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest)
        {
            FolderSyncResponse response = this.activeSyncClient.FolderSync(folderSyncRequest);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
            return(response);
        }
예제 #2
0
        public void MSASPROV_S01_TC02_WithoutAcknowledgingSecurityPolicySettings()
        {
            #region Switch the current user to the user with setting AllowNonProvisionableDevices to true.
            this.SwitchUser(this.User3Information, false);
            #endregion

            #region Apply string.Empty to PolicyKey.
            this.PROVAdapter.ApplyPolicyKey(string.Empty);
            #endregion

            #region Call FolderSync command without Provision.
            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}], actual is [{1}]", HttpStatusCode.OK, folderSynReponse.StatusCode);

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

                // Verify MS-ASPROV requirement: MS-ASPROV_R509
                // The FolderSync command executed successfully without Provision, so this requirement can be captured.
                Site.CaptureRequirement(
                    509,
                    @"[In Appendix A: Product Behavior] The implementation does require that the client device has requested and acknowledged the security policy settings before the client is allowed to synchronize with the server, unless a security policy is set on the implementation to allow it [client is allowed to synchronize with the implementation]. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion
        }
        /// <summary>
        /// Synchronizes the collection hierarchy.
        /// </summary>
        /// <param name="request">A FolderSyncRequest object that contains the request information.</param>
        /// <returns>A FolderSyncResponse object.</returns>
        public FolderSyncResponse FolderSync(FolderSyncRequest request)
        {
            FolderSyncResponse response = this.activeSyncClient.FolderSync(request);

            Site.Assert.IsNotNull(response, "If the FolderSync command executes successfully, the response from server should not be null.");
            return(response);
        }
예제 #4
0
        public void MSASCMD_S04_TC07_FolderSync_AddFolder()
        {
            #region The client calls FolderCreate command to create a new folder as a child folder of the specified parent folder, then server returns ServerId for FolderCreate command.
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderSync"), "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Call method FolderSync to synchronize the collection hierarchy.
            FolderSyncResponse folderSyncResponse = this.FolderSync();
            bool isVerifyR5860 = false;
            foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add)
            {
                if (add.ServerId == folderCreateResponse.ResponseData.ServerId)
                {
                    isVerifyR5860 = true;
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5860
            Site.CaptureRequirementIfIsTrue(
                isVerifyR5860,
                5860,
                @"[In Add(FolderSync)] [The Add element] creates a new folder on the client.");
            #endregion
        }
        /// <summary>
        /// Loop to call FolderSync command and get the response till FolderSync Response's Content-Encoding header is gzip.
        /// </summary>
        /// <returns>The response of FolderSync command.</returns>
        private FolderSyncResponse LoopCallFolderSyncCommand()
        {
            #region Loop to call FolderSync
            int counter    = 0;
            int waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", Site));
            int upperBound = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", Site));
            FolderSyncResponse folderSyncResponse = this.CallFolderSyncCommand();
            while (counter < upperBound && !folderSyncResponse.Headers.ToString().Contains("Content-Encoding"))
            {
                System.Threading.Thread.Sleep(waitTime);
                folderSyncResponse = this.CallFolderSyncCommand();
                counter++;
            }
            #endregion

            #region Call ConfigureRequestPrefixFields to reset the AcceptEncoding header.
            IDictionary <HTTPPOSTRequestPrefixField, string> requestPrefix = new Dictionary <HTTPPOSTRequestPrefixField, string>();
            requestPrefix[HTTPPOSTRequestPrefixField.AcceptEncoding] = null;
            this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
            #endregion

            #region Return FolderSync response
            Site.Assert.IsNotNull(folderSyncResponse.Headers["Content-Encoding"], "The Content-Encoding header should exist in the response headers after retry {0} times", counter);

            return(folderSyncResponse);

            #endregion
        }
        public void MSASHTTP_S01_TC01_VerifyContentTypeResponseHeader()
        {
            #region Synchronize the collection hierarchy via FolderSync command.
            FolderSyncResponse folderSyncResponse = this.CallFolderSyncCommand();
            Site.Assert.IsNotNull(folderSyncResponse.Headers["Content-Type"], "The Content-Type header should not be null.");
            #endregion

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R219
            // If the content type is WBXML, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "application/vnd.ms-sync.wbxml",
                folderSyncResponse.Headers["Content-Type"],
                219,
                @"[In Content-Type] If the response body is WBXML, the value of this [Content-Type] header MUST be ""application/vnd.ms-sync.wbxml"".");

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R229
            // If the content type is WBXML, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "application/vnd.ms-sync.wbxml",
                folderSyncResponse.Headers["Content-Type"],
                229,
                @"[In Response Body] The response body [except the Autodiscover command], if any, is in WBXML.");
        }
예제 #7
0
        /// <summary>
        /// Change user to call ActiveSync operations and resynchronize the collection hierarchy.
        /// </summary>
        /// <param name="userInformation">The information of the user.</param>
        /// <param name="isFolderSyncNeeded">A Boolean value that indicates whether needs to synchronize the folder hierarchy.</param>
        protected void SwitchUser(UserInformation userInformation, bool isFolderSyncNeeded)
        {
            this.EMAILAdapter.SwitchUser(userInformation.UserName, userInformation.UserPassword, userInformation.UserDomain);

            if (isFolderSyncNeeded)
            {
                // Call FolderSync command to synchronize the collection hierarchy.
                FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest("0");
                FolderSyncResponse folderSyncResponse = this.EMAILAdapter.FolderSync(folderSyncRequest);

                // Verify FolderSync command response.
                Site.Assert.AreEqual <int>(
                    1,
                    int.Parse(folderSyncResponse.ResponseData.Status),
                    "If the FolderSync command executes successfully, the Status in response should be 1.");
                if (string.IsNullOrEmpty(userInformation.InboxCollectionId))
                {
                    userInformation.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Inbox, this.Site);
                }

                if (string.IsNullOrEmpty(userInformation.DeletedItemsCollectionId))
                {
                    userInformation.DeletedItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.DeletedItems, this.Site);
                }

                if (string.IsNullOrEmpty(userInformation.CalendarCollectionId))
                {
                    userInformation.CalendarCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Calendar, this.Site);
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Synchronizes the collection hierarchy from server.
        /// </summary>
        /// <param name="folderSyncRequest">The request of FolderSync command.</param>
        /// <returns>The response of FolderSync command.</returns>
        public FolderSyncResponse FolderSync(FolderSyncRequest folderSyncRequest)
        {
            FolderSyncResponse folderSyncResponse = this.activeSyncClient.FolderSync(folderSyncRequest);

            Site.Assert.IsNotNull(folderSyncResponse, "The FolderSync response returned from server should not be null.");
            return(folderSyncResponse);
        }
예제 #9
0
        /// <summary>
        /// This method is used to change user to call ActiveSync commands and resynchronize the folder collection hierarchy.
        /// </summary>
        /// <param name="userInformation">The information of the user that will switch to.</param>
        /// <param name="isFolderSyncNeeded">A boolean value indicates whether needs to synchronize the folder hierarchy.</param>
        protected void SwitchUser(UserInformation userInformation, bool isFolderSyncNeeded)
        {
            this.CALAdapter.SwitchUser(userInformation.UserName, userInformation.UserPassword, userInformation.UserDomain);

            if (isFolderSyncNeeded)
            {
                FolderSyncResponse folderSyncResponse = this.CALAdapter.FolderSync();

                // Get the folder collectionId of User1
                if (userInformation.UserName == this.User1Information.UserName)
                {
                    if (string.IsNullOrEmpty(this.User1Information.InboxCollectionId))
                    {
                        this.User1Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Inbox, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User1Information.CalendarCollectionId))
                    {
                        this.User1Information.CalendarCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Calendar, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User1Information.SentItemsCollectionId))
                    {
                        this.User1Information.SentItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.SentItems, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User1Information.DeletedItemsCollectionId))
                    {
                        this.User1Information.DeletedItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.DeletedItems, this.Site);
                    }
                }

                // Get the folder collectionId of User2
                if (userInformation.UserName == this.User2Information.UserName)
                {
                    if (string.IsNullOrEmpty(this.User2Information.InboxCollectionId))
                    {
                        this.User2Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Inbox, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User2Information.CalendarCollectionId))
                    {
                        this.User2Information.CalendarCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Calendar, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User2Information.SentItemsCollectionId))
                    {
                        this.User2Information.SentItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.SentItems, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User2Information.DeletedItemsCollectionId))
                    {
                        this.User2Information.DeletedItemsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.DeletedItems, this.Site);
                    }
                }

                this.CurrentUserInformation = userInformation;
            }
        }
예제 #10
0
        /// <summary>
        /// Initial folder sync
        /// </summary>
        /// <returns>SyncKey returned from server</returns>
        private string GetFolderSyncKey()
        {
            FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse foldersyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);
            string             folderSynKey       = foldersyncResponse.ResponseData.SyncKey;

            return(folderSynKey);
        }
예제 #11
0
        private Add[] GetAllFoldersOnServer(out string newSyncKey)
        {
            FolderSyncResponse folderSyncResponse = this.EasConnectionWrapper.FolderSync();
            List <Add>         additions          = folderSyncResponse.Changes.Additions;

            newSyncKey = folderSyncResponse.SyncKey;
            return(additions.ToArray());
        }
        public void MSASHTTP_S01_TC02_VerifyContentEncodingResponseHeader()
        {
            #region Call FolderSync command without setting AcceptEncoding header.
            FolderSyncResponse folderSyncResponse = this.CallFolderSyncCommand();

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R412
            // If the Content-Encoding header doesn't exist, this requirement can be captured.
            Site.CaptureRequirementIfIsFalse(
                folderSyncResponse.Headers.ToString().Contains("Content-Encoding"),
                412,
                @"[In Response Headers] [[Header] Content-Encoding [is] required when the content is compressed ;] otherwise, this header [Content-Encoding] is not included.");

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R215
            // If the Content-Encoding header doesn't exist, this requirement can be captured.
            Site.CaptureRequirementIfIsFalse(
                folderSyncResponse.Headers.ToString().Contains("Content-Encoding"),
                215,
                @"[In Content-Encoding] Otherwise [if the response body is not compressed], it [Content-Encoding header] is omitted.");
            #endregion

            #region Call ConfigureRequestPrefixFields to set the AcceptEncoding header to "gzip".
            IDictionary <HTTPPOSTRequestPrefixField, string> requestPrefix = new Dictionary <HTTPPOSTRequestPrefixField, string>();
            requestPrefix.Add(HTTPPOSTRequestPrefixField.AcceptEncoding, "gzip");
            this.HTTPAdapter.ConfigureRequestPrefixFields(requestPrefix);
            #endregion

            #region Call FolderSync command.
            folderSyncResponse = this.LoopCallFolderSyncCommand();

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R197
            // If the Content-Encoding header is gzip, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "gzip",
                folderSyncResponse.Headers["Content-Encoding"],
                197,
                @"[In Response Headers] [Header] Content-Encoding [is] required when the content is compressed [; otherwise, this header [Content-Encoding] is not included].");

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

            // Verify MS-ASHTTP requirement: MS-ASHTTP_R214
            // If the Content-Encoding header is gzip, this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "gzip",
                folderSyncResponse.Headers["Content-Encoding"],
                214,
                @"[In Content-Encoding] This [Content-Encoding] header is required if the response body is compressed.");
            #endregion
        }
        /// <summary>
        /// Synchronize the collection hierarchy.
        /// </summary>
        /// <returns>A FolderSync command response returned from the server.</returns>
        public FolderSyncResponse FolderSync()
        {
            FolderSyncRequest  request            = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse folderSyncResponse = this.activeSyncClient.FolderSync(request);

            Site.Assert.IsNotNull(folderSyncResponse, "The FolderSync response should be returned.");

            return(folderSyncResponse);
        }
예제 #14
0
        /// <summary>
        /// FolderSync command to synchronize the collection hierarchy
        /// </summary>
        /// <returns>The FolderSync response</returns>
        public FolderSyncResponse FolderSync()
        {
            FolderSyncRequest  request  = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse response = this.activeSyncClient.FolderSync(request);

            this.calendarId = Common.GetDefaultFolderServerId(response, FolderType.Calendar, this.Site);

            return(response);
        }
        public void MSASCMD_S05_TC07_FolderUpdate_Moves()
        {
            #region Call method FolderCreate to create a new folder as a child folder of the mailbox Root folder.
            string folderName = Common.GenerateResourceName(Site, "FolderCreate");
            FolderCreateRequest  folderCreateRequest  = Common.CreateFolderCreateRequest(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0");
            FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest);
            string folderServerId1 = folderCreateResponse.ResponseData.ServerId;
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Call method FolderUpdate to move the new created folder from the mailbox Root folder to SentItems folder on the server.
            FolderUpdateRequest  folderUpdateRequest  = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderServerId1, folderName, ((byte)FolderType.SentItems).ToString());
            FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest);
            Site.Assert.AreEqual <int>(1, int.Parse(folderUpdateResponse.ResponseData.Status), "Server should return status 1 to indicate FolderUpdate command success.");
            #endregion

            #region Call method FolderSync to synchronize the collection hierarchy.
            FolderSyncResponse folderSyncResponse = this.FolderSync();
            bool isFolderMoved = false;
            foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add)
            {
                if ((add.ServerId == folderServerId1) && (add.ParentId == ((byte)FolderType.SentItems).ToString()))
                {
                    isFolderMoved = true;
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R139
            Site.CaptureRequirementIfIsTrue(
                isFolderMoved,
                139,
                @"[In FolderUpdate] The FolderUpdate command moves a folder from one location to another on the server.");

            // Call method FolderCreate to create another new folder which its name is same with above step as a child folder of the mailbox Root folder.
            folderCreateRequest  = Common.CreateFolderCreateRequest(folderSyncResponse.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "0");
            folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest);
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);

            // Call method FolderUpdate to move the newest created folder in mailbox Root folder from mailbox Root folder to SentItems folder on the server.
            folderUpdateRequest  = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderCreateResponse.ResponseData.ServerId, folderName, ((byte)FolderType.SentItems).ToString());
            folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5438
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(folderUpdateResponse.ResponseData.Status),
                5438,
                @"[In Status(FolderUpdate)] [When the scope is Item], [the cause of the status value 2 is] A folder with that name already exists [or the specified folder is a special folder, such as the Inbox, Outbox, Contacts, or Drafts folders. Special folders cannot be updated].");
            #endregion
        }
예제 #16
0
        public void MSASCMD_S04_TC08_FolderSync_UpdateFolder()
        {
            #region Call method FolderCreate command to create a new folder as a child folder of the specified parent folder.
            string folderName = Common.GenerateResourceName(Site, "FolderSync");
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Change DeviceID
            this.CMDAdapter.ChangeDeviceID("NewDeviceID");
            this.RecordDeviceInfoChanged();
            string folderSyncKey = folderCreateResponse.ResponseData.SyncKey;
            #endregion

            #region Call method FolderSync to synchronize the collection hierarchy.
            FolderSyncResponse foldersyncResponseForNewDeviceID = this.FolderSync();
            string             changeDeviceIDFolderId           = TestSuiteBase.GetCollectionId(foldersyncResponseForNewDeviceID, folderName);
            Site.Assert.IsFalse(string.IsNullOrEmpty(changeDeviceIDFolderId), "If the new folder created by FolderCreate command, server should return a server ID for the new created folder.");

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

            // If client sends the FolderSync request successfully, the server must send a synchronization key to the client in a response.
            Site.CaptureRequirementIfIsTrue(
                (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != null) && (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != folderSyncKey),
                5020,
                @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 1:] The server responds with [the folder hierarchy and] a new folderhierarchy:SyncKey value.");

            #endregion

            #region Call method FolderUpdate to rename a folder.
            string folderUpdateName = Common.GenerateResourceName(Site, "FolderUpdate");
            FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(foldersyncResponseForNewDeviceID.ResponseData.SyncKey, changeDeviceIDFolderId, folderUpdateName, "0");
            this.CMDAdapter.FolderUpdate(folderUpdateRequest);
            #endregion

            #region Restore DeviceID and call FolderSync command.
            this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));

            // The client calls FolderSync command to synchronize the collection hierarchy with original device id.
            FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest(folderSyncKey);
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);
            bool isUpdated = false;
            foreach (Response.FolderSyncChangesUpdate update in folderSyncResponse.ResponseData.Changes.Update)
            {
                if (update.DisplayName == folderUpdateName)
                {
                    isUpdated = true;
                    break;
                }
            }

            Site.Assert.IsTrue(isUpdated, "Rename successfully");
            #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
        }
        public void MSASCMD_S05_TC01_FolderUpdate_Success()
        {
            #region Call method FolderCreate command to create a new folder as a child folder of the specified parent folder.
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Call method FolderUpdate to rename a folder.
            string updateFolderName = Common.GenerateResourceName(Site, "FolderUpdate");
            FolderUpdateRequest  folderUpdateRequest  = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderCreateResponse.ResponseData.ServerId, updateFolderName, "0");
            FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest);
            #endregion

            #region Call method FolderSync to synchronize the collection hierarchy.
            FolderSyncResponse folderSyncResponse = this.FolderSync();
            bool isFolderRenamed = false;
            foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add)
            {
                if ((add.DisplayName == updateFolderName) && (add.ServerId == folderCreateResponse.ResponseData.ServerId))
                {
                    isFolderRenamed = true;
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R140
            Site.CaptureRequirementIfIsTrue(
                isFolderRenamed,
                140,
                @"[In FolderUpdate] The [FolderUpdate] command is also used to rename a folder.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4100
            Site.CaptureRequirementIfAreEqual <string>(
                "1",
                folderUpdateResponse.ResponseData.Status,
                4100,
                @"[In Status(FolderUpdate)] [When the scope is Global], [the cause of the status value 1 is] Server successfully completed command.");

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

            // IF folder has been updated successfully, the server must send a synchronization key to the client in a response.
            Site.CaptureRequirementIfIsNotNull(
                folderUpdateResponse.ResponseData.SyncKey,
                5784,
                @"[In SyncKey(FolderCreate, FolderDelete, and FolderUpdate)] After a successful [FolderCreate command (section 2.2.2.2), FolderDelete command (section 2.2.2.3), or] FolderUpdate command (section 2.2.2.5), the server MUST send a synchronization key to the client in a response.");
            #endregion
        }
예제 #19
0
        /// <summary>
        /// This method is used to synchronize the folder collection hierarchy.
        /// </summary>
        /// <returns>The response of the FolderSync command.</returns>
        private FolderSyncResponse FolderSync()
        {
            FolderSyncResponse folderSyncResponse = this.ASAIRSAdapter.FolderSync(Common.CreateFolderSyncRequest("0"));

            this.Site.Assert.AreEqual <string>(
                "1",
                folderSyncResponse.ResponseData.Status,
                "The Status value should be 1 to indicate the FolderSync command executes successfully.");

            return(folderSyncResponse);
        }
예제 #20
0
        public void MSASCMD_S11_TC05_Ping_Status7_Outdate()
        {
            #region Change a new user to call ActiveSync operation with a new DeviceID.
            this.CMDAdapter.SwitchUser(this.User3Information.UserName, this.User3Information.UserPassword, this.User3Information.UserDomain);

            // Record user that uses new DeviceID
            this.RecordDeviceInfoChanged();
            this.CMDAdapter.ChangeDeviceID("FirstDeviceID");
            #endregion

            #region Sync user folder changes
            this.FolderSync();
            #endregion

            #region Switch to new device and create one folder
            this.CMDAdapter.ChangeDeviceID("SecondDeviceID");
            string folderSynKey = this.GetFolderSyncKey();

            // Create one mail type folder
            string newFolderName = Guid.NewGuid().ToString().Replace("-", string.Empty);
            FolderCreateRequest  folderCreateRequest  = Common.CreateFolderCreateRequest(folderSynKey, 12, newFolderName, this.User1Information.InboxCollectionId);
            FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest);
            Site.Assert.AreEqual <int>(
                1,
                int.Parse(folderCreateResponse.ResponseData.Status),
                "After folder create success, server should return status 1");
            #endregion

            #region Switch back to old device and send one ping request
            this.CMDAdapter.ChangeDeviceID("FirstDeviceID");
            PingRequest  pingRequest  = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email);
            PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest);
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4257
            Site.CaptureRequirementIfAreEqual <int>(
                7,
                int.Parse(pingResponse.ResponseData.Status),
                4257,
                @"[In Status(Ping)] [When the scope is Global], [the cause of the status value 7 is] The folder hierarchy is out of date.");

            #region Record new created folder collection ID.
            // Get new created folder collection ID
            FolderSyncRequest  folderSyncRequestForNewFolder  = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse folderSyncResponseForNewFolder = this.CMDAdapter.FolderSync(folderSyncRequestForNewFolder);

            // Gets the server ID for new folder after change DeviceID.
            string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewFolder, newFolderName);
            TestSuiteBase.RecordCaseRelativeFolders(this.User3Information, serverId);
            #endregion
        }
예제 #21
0
        public void MSASCMD_S04_TC05_FolderSync_Status9()
        {
            // Call method FolderSync with an empty SyncKey to synchronize the collection hierarchy.
            FolderSyncRequest folderSyncRequest = new FolderSyncRequest {
                RequestData = { SyncKey = string.Empty }
            };
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);

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

            // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response.
            // Verify MS-ASCMD requirement: MS-ASCMD_R4068
            Site.CaptureRequirementIfAreEqual <int>(
                9,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4068,
                @"[In Status(FolderSync)] If the command fails, the Status element contains a code that indicates the type of failure.");

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

            // If the client sent a malformed or mismatched synchronization key, the server should return a status code 9 in the FolderSync command response.
            // Verify MS-ASCMD requirement: MS-ASCMD_R4070
            Site.CaptureRequirementIfAreEqual <int>(
                9,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4070,
                @"[In Status(FolderSync)] If one collection fails, a failure status MUST be returned for all collections.");

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

            // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key.
            // If the SyncKey is an empty string, the status is equal to 9.
            Site.CaptureRequirementIfAreEqual <int>(
                9,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4083,
                @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 9 is] The client sent a malformed or mismatched synchronization key [, or the synchronization state is corrupted on the server].");

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

            // The server should return a status code 9 in the FolderSync command response to indicate the client sent a malformed or mismatched synchronization key.
            // Verify MS-ASCMD requirement: MS-ASCMD_R4581
            Site.CaptureRequirementIfAreEqual <int>(
                9,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4581,
                @"[In SyncKey(FolderSync)] The server MUST return a Status element (section 2.2.3.162.4) value of 9 if the value of the SyncKey element does not match the value of the synchronization key on the server.");
        }
예제 #22
0
        /// <summary>
        /// Synchronizes the collection hierarchy
        /// </summary>
        /// <param name="request">A FolderSyncRequest object that contains the request information.</param>
        /// <returns>FolderSync command response</returns>
        public FolderSyncResponse FolderSync(FolderSyncRequest request)
        {
            FolderSyncResponse response = this.activeSyncClient.FolderSync(request);

            this.VerifyTransportRequirements();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                this.VerifyWBXMLCapture(CommandName.FolderSync, response);
                this.VerifyFolderSyncCommand(response);
            }

            return(response);
        }
예제 #23
0
        public void MSASCMD_S04_TC09_FolderSync_DeleteFolder()
        {
            #region The client calls FolderCreate command to create a new folder as a child folder of the specified parent folder, then server returns ServerId for FolderCreate command.
            string folderName = Common.GenerateResourceName(Site, "FolderSync");
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            #endregion

            #region Changes DeviceID.
            this.CMDAdapter.ChangeDeviceID("NewDeviceID");
            this.RecordDeviceInfoChanged();
            #endregion

            #region Calls method FolderSync to synchronize the collection hierarchy.
            FolderSyncRequest  folderSyncRequestForNewDeviceID  = Common.CreateFolderSyncRequest("0");
            FolderSyncResponse folderSyncResponseForNewDeviceID = this.CMDAdapter.FolderSync(folderSyncRequestForNewDeviceID);

            // Gets the server ID for new folder after change DeviceID.
            string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewDeviceID, folderName);
            Site.Assert.IsNotNull(serverId, "Call method GetServerId to get a non-null ServerId to indicate success.");
            #endregion

            #region The client calls FolderDelete command to delete the created folder in step 2 from the server.
            FolderDeleteRequest  folderDeleteRequest  = Common.CreateFolderDeleteRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, serverId);
            FolderDeleteResponse folderDeleteResponse = this.CMDAdapter.FolderDelete(folderDeleteRequest);
            Site.Assert.AreEqual <int>(1, int.Parse(folderDeleteResponse.ResponseData.Status), "The server should return a status code 1 in the FolderDelete command response to indicate success.");
            #endregion

            #region Restore DeviceID and call FolderSync command
            this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));

            // The client calls FolderSync command to synchronize the collection hierarchy with original device id.
            FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest(folderCreateResponse.ResponseData.SyncKey);
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);
            Site.Assert.AreEqual <int>(1, int.Parse(folderSyncResponse.ResponseData.Status), "Server should return status 1 in the FolderSync response to indicate success.");
            Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes, "Server should return Changes element in the FolderSync response after the collection hierarchy changed by call FolderDelete command.");
            Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes.Delete, "Server should return Changes element in the FolderSync response after the specified folder deleted.");

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

            // The folderDeleteSuccess is true indicates the folder which deleted by FolderDelete command is deleted successfully.
            // Verify MS-ASCMD requirement: MS-ASCMD_R5863
            Site.CaptureRequirementIfIsNotNull(
                folderSyncResponse.ResponseData.Changes.Delete[0].ServerId,
                5863,
                @"[In Delete(FolderSync)] [The Delete element] specifies that a folder on the server was deleted since the last folder synchronization.");
            #endregion
        }
예제 #24
0
        public void MSASCMD_S04_TC02_FolderSync_NoChanged()
        {
            // The client calls FolderSync command to synchronize the collection hierarchy if no changes occurred for folder.
            FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest(this.LastFolderSyncKey);
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R2120
            Site.CaptureRequirementIfAreEqual <uint>(
                0,
                folderSyncResponse.ResponseData.Changes.Count,
                2120,
                @"[In Count] If there are no changes since the last folder synchronization, a Count element value of 0 (zero) is returned.");
        }
        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_TC10_CommonStatusCode_109()
        {
            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 Call FolderSync with a invaild format deviceType
            this.CMDAdapter.ChangeHeaderEncodingType(QueryValueType.PlainText);
            this.CMDAdapter.ChangeDeviceType("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
            FolderSyncResponse response = this.FolderSync();

            this.Site.CaptureRequirementIfAreEqual <int>(
                109,
                int.Parse(response.ResponseData.Status),
                4830,
                @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0,  [The meaning of the status value 109 is] The device type is either missing or has an invalid format.");
            this.CMDAdapter.ChangeDeviceType(Common.GetConfigurationPropertyValue("DeviceType", this.Site));
            #endregion
        }
예제 #27
0
        public void MSASCMD_S04_TC03_FolderSync_Changed()
        {
            #region Change a new DeviceID and call FolderSync command.
            this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));
            FolderSyncResponse folderSyncResponseForDefaultDeviceID = this.FolderSync();
            #endregion

            #region Change a new DeviceID and call FolderSync command.
            this.CMDAdapter.ChangeDeviceID("NewDeviceID");
            this.RecordDeviceInfoChanged();
            string             folderName = Common.GenerateResourceName(Site, "FolderSync");
            FolderSyncResponse folderSyncResponseForNewDeviceID = this.FolderSync();
            #endregion

            #region Call method FolderCreate to create a new folder as a child folder of the specified parent folder.
            FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "0");
            Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success.");
            TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId);
            #endregion

            #region Change the DeviceId back and call method FolderSync to synchronize the collection hierarchy.
            this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site));
            FolderSyncRequest  folderSyncRequest  = Common.CreateFolderSyncRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey);
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);
            foreach (Response.FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add)
            {
                if (add.DisplayName == folderName)
                {
                    this.User1Information.UserCreatedFolders.Clear();
                    TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, add.ServerId);
                    break;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5024
            Site.CaptureRequirementIfAreEqual <uint>(
                (uint)1,
                folderSyncResponse.ResponseData.Changes.Count,
                5024,
                @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 2:] If any changes have occurred on the server, the new, deleted, or changed folders are returned to the client.");
            #endregion
        }
예제 #28
0
        public void MSASCMD_S04_TC06_FolderSync_Status10()
        {
            // Call method FolderSync to synchronize the collection hierarchy with a null SyncKey.
            FolderSyncRequest folderSyncRequest = new FolderSyncRequest {
                RequestData = { SyncKey = null }
            };
            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest);

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

            // If the SyncKey is invalid, the status is equal to 10.
            Site.CaptureRequirementIfAreEqual <int>(
                10,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4086,
                @"[In Status(FolderSync)] [When the scope is Global], [the cause of the status value 10 is] The client sent a FolderSync command request that contains a semantic or syntactic error.");
        }
        public void MSASCMD_S21_TC07_CommonStatusCode_102()
        {
            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 call FolderSync command containing a FileReference element which is not defined in FolderSync request.
            FolderSyncRequest  request     = new FolderSyncRequest();
            Request.FolderSync requestData = new Request.FolderSync {
                FileReference = "0", FileReferenceSpecified = true
            };
            request.RequestData = requestData;

            FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(request);
            this.Site.CaptureRequirementIfAreEqual <int>(
                102,
                int.Parse(folderSyncResponse.ResponseData.Status),
                4815,
                @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0,  [The meaning of the status value 102 is] The request contains WBXML but it could not be decoded into XML.");
            #endregion
        }
예제 #30
0
        private MailboxChangesManifest GetFolderChangesOnServer(string syncKey, out string newSyncKey, out IReadOnlyCollection <Add> newFolders)
        {
            newFolders = null;
            FolderSyncResponse folderSyncResponse = base.EasConnectionWrapper.FolderSync(syncKey);

            newSyncKey = folderSyncResponse.SyncKey;
            MailboxChangesManifest mailboxChangesManifest = new MailboxChangesManifest();

            mailboxChangesManifest.ChangedFolders = new List <byte[]>(0);
            mailboxChangesManifest.DeletedFolders = new List <byte[]>(0);
            if (folderSyncResponse.Changes != null)
            {
                List <Add> additions = folderSyncResponse.Changes.Additions;
                if (additions != null && additions.Count > 0)
                {
                    mailboxChangesManifest.ChangedFolders.Capacity += additions.Count;
                    foreach (Add add in additions)
                    {
                        mailboxChangesManifest.ChangedFolders.Add(EasMailbox.GetEntryId(add.ServerId));
                    }
                    newFolders = additions;
                }
                List <Update> updates = folderSyncResponse.Changes.Updates;
                if (updates != null && updates.Count > 0)
                {
                    mailboxChangesManifest.ChangedFolders.Capacity += updates.Count;
                    foreach (Update update in updates)
                    {
                        mailboxChangesManifest.ChangedFolders.Add(EasMailbox.GetEntryId(update.ServerId));
                    }
                }
                List <Delete> deletions = folderSyncResponse.Changes.Deletions;
                if (deletions != null && deletions.Count > 0)
                {
                    mailboxChangesManifest.DeletedFolders.Capacity = deletions.Count;
                    foreach (Delete delete in deletions)
                    {
                        mailboxChangesManifest.DeletedFolders.Add(EasMailbox.GetEntryId(delete.ServerId));
                    }
                }
            }
            return(mailboxChangesManifest);
        }
예제 #31
0
        /// <summary>
        /// Use this method to get a ServerId.
        /// </summary>
        /// <param name="folderSyncResponse">An instance of the FolderSyncResponse.</param>
        /// <param name="folderName">Folder name.</param>
        /// <returns>The collection ID of the specified folder.</returns>
        protected static string GetCollectionId(FolderSyncResponse folderSyncResponse, string folderName)
        {
            string serverId = string.Empty;
            foreach (Response.FolderSyncChangesAdd changes in folderSyncResponse.ResponseData.Changes.Add)
            {
                if (changes.DisplayName == folderName)
                {
                    serverId = changes.ServerId;
                    break;
                }
            }

            return serverId;
        }
예제 #32
0
        /// <summary>
        /// This method is used to verify the FolderSync response related requirements.
        /// </summary>
        /// <param name="folderSyncResponse">FolderSync command response.</param>
        private void VerifyFolderSyncCommand(FolderSyncResponse folderSyncResponse)
        {
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "The schema validation result should be true.");
            Site.Assert.IsNotNull(folderSyncResponse.ResponseData, "The FolderSync element should not be null.");

            #region Capture code for FolderSync
            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3096");

            // If the schema validation result is true and FolderSync is not null, this requirement can be verified.
            Site.CaptureRequirement(
                3096,
                @"[In FolderSync] The FolderSync element is a required element in FolderSync command requests and FolderSync command responses that identifies the body of the HTTP POST as containing a FolderSync command (section 2.2.2.4).");

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

            // If the schema validation result is true and FolderSync is not null, this requirement can be verified.
            Site.CaptureRequirement(
                1715,
                @"[In FolderSync] None [Element FolderSync in FolderSync command response has no parent element.]");

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

            // If the schema validation result is true and FolderSync is not null, this requirement can be verified.
            Site.CaptureRequirement(
                1716,
                @"[In FolderSync] Element FolderSync in FolderSync command response, the child elements are SyncKey, Status, (section 2.2.3.164.4), Changes (section 2.2.3.25).");

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

            // If the schema validation result is true and FolderSync is not null, this requirement can be verified.
            Site.CaptureRequirement(
                1717,
                @"[In FolderSync] Element FolderSync in FolderSync command response, the data type is container.");

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

            // If the schema validation result is true and FolderSync is not null, this requirement can be verified.
            Site.CaptureRequirement(
                1718,
                @"[In FolderSync] Element FolderSync in FolderSync command response, the number allowed is  1…1 (required).");

            this.VerifyContainerDataType();
            #endregion

            #region Capture code for SyncKey(FolderSync)
            if (folderSyncResponse.ResponseData.SyncKey != null)
            {
                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2827");

                // If the schema validation result is true and SyncKey(FolderSync) is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2827,
                    @"[In SyncKey(FolderSync)] Element SyncKey in FolderSync command response, the parent element is FolderSync.");

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

                // If the schema validation result is true and SyncKey(FolderSync) is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2828,
                    @"[In SyncKey(FolderSync)] None [Element SyncKey in FolderSync command response has no child element.]");

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

                // If the schema validation result is true and SyncKey(FolderSync) is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2829,
                    @"[In SyncKey(FolderSync)] Element SyncKey in FolderSync command response, the child element is string.");

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

                // If the schema validation result is true and SyncKey(FolderSync) is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2830,
                    @"[In SyncKey(FolderSync)] Element SyncKey in FolderSync command response, the number allowed is 0…1 (optional).");

                this.VerifyStringDataType();
            }
            #endregion

            #region Capture code for Status(FolderSync)
            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4066");

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                4066,
                @"[In Status(FolderSync)] The Status element is a required child element of the FolderSync element in FolderSync command responses that indicates the success or failure of a FolderSync command request (section 2.2.2.4).");

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

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                2703,
                @"[In Status(FolderSync)] Element Status in FolderSync command response, the parent element is FolderSync (section 2.2.3.71).");

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

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                2704,
                @"[In Status(FolderSync)] None [Element Status in FolderSync command response has no child element.]");

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

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                2705,
                @"[In Status(FolderSync)] Element Status in FolderSync command response, the data type is unsignedByte ([MS-ASDTYPE] section 2.8).");

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

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                2706,
                @"[In Status(FolderSync)] Element Status in FolderSync command response, the number allowed is 1…1 (required).");

            Common.VerifyActualValues("Status(FolderSync)", AdapterHelper.ValidStatus(new string[] { "1", "6", "9", "10", "11", "12" }), folderSyncResponse.ResponseData.Status.ToString(), this.Site);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4071
            // If above Common.VerifyActualValues method is not failed, this requirement can be verified.
            Site.CaptureRequirement(
                4071,
                @"[In Status(FolderSync)] The following table lists the status codes [1,6,9,10,11,12] for the FolderSync command (section 2.2.2.4). For information about the scope of the status value and for status values common to all ActiveSync commands, see section 2.2.4.");

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

            // If the schema validation result is true, this requirement can be verified.
            Site.CaptureRequirement(
                4094,
                @"[In Status(FolderUpdate)] The Status element is a required child element of the FolderUpdate element in FolderUpdate command responses that indicates the success or failure of a FolderUpdate command request (section 2.2.2.5).");

            this.VerifyIntegerDataType();

            #endregion

            #region Capture code for Changes
            if (folderSyncResponse.ResponseData.Changes != null)
            {
                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R1155");

                // If the schema validation result is true and Changes is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1155,
                    @"[In Changes] Element Changes in FolderSync command response (section 2.2.2.4), the parent element is FolderSync (section 2.2.3.71).");

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

                // If the schema validation result is true and Changes is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1156,
                    @"[In Changes] Element Changes in FolderSync command response (section 2.2.2.4), the child elements are Count (section 2.2.3.37), Update (section 2.2.3.177), Delete (section 2.2.3.42.1), Add (section 2.2.3.7.1).");

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

                // If the schema validation result is true and Changes is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1157,
                    @"[In Changes]  Element Changes in FolderSync command response (section 2.2.2.4), the data type is container ([MS-ASDTYPE] section 2.2).");

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

                // If the schema validation result is true and Changes is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1158,
                    @"[In Changes] Element Changes in FolderSync command response (section 2.2.2.4), the number allowed is  0…1 (optional).");

                this.VerifyContainerDataType();

                #region Capture code for Count
                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R1454");

                // If the schema validation result is true and Count is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1454,
                    @"[In Count] Element Count in FolderSync command response (section 2.2.2.4), the parent element is Changes (section 2.2.3.25).");

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

                // If the schema validation result is true and Count is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1455,
                    @"[In Count] None [Element Count in FolderSync command response (section 2.2.2.4) has no child element.]");

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

                // Verify MS-ASCMD requirement: MS-ASCMD_R1456
                Site.CaptureRequirementIfAreEqual<Type>(
                    typeof(uint),
                    folderSyncResponse.ResponseData.Changes.Count.GetType(),
                    1456,
                    @"[In Count] Element Count in FolderSync command response (section 2.2.2.4), the data type is unsigned integer ([MS-ASDTYPE] section 2.6).");

                this.VerifyIntegerDataType();

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

                // If the schema validation result is true and Count is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    1457,
                    @"[In Count] Element Count in FolderSync command response (section 2.2.2.4), the number allowed is 0…1 (optional).");

                #endregion

                #region Capture code for Delete(FolderSync)
                if (folderSyncResponse.ResponseData.Changes.Delete != null && folderSyncResponse.ResponseData.Changes.Delete.Length > 0)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R1482");

                    // If the schema validation result is true and Delete(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1482,
                        @"[In Delete(FolderSync)] Element Delete in FolderSync command response (section 2.2.2.4), the parent element is Changes (section 2.2.3.25).");

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

                    // If the schema validation result is true and Delete(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1483,
                        @"[In Delete(FolderSync)] Element Delete in FolderSync command response (section 2.2.2.4), the child element is ServerId (section 2.2.3.156.3).");

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

                    // If the schema validation result is true and Delete(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1484,
                        @"[In Delete(FolderSync)] Element Delete in FolderSync command response (section 2.2.2.4), the data type is container ([MS-ASDTYPE] section 2.2).");

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

                    // If the schema validation result is true and Delete(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1485,
                        @"[In Delete(FolderSync)] Element Delete in FolderSync command response (section 2.2.2.4), the number allowed is 0...N (optional).");

                    this.VerifyContainerDataType();

                    foreach (FolderSyncChangesDelete folderSyncChangesDelete in folderSyncResponse.ResponseData.Changes.Delete)
                    {
                        #region Capture code for ServerId
                        Site.Assert.IsNotNull(folderSyncChangesDelete.ServerId, "The ServerId(FolderSync) should not be null.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3911,
                            @"[In ServerId(FolderSync)] The ServerId element is a required child element of the Update element, the Delete element, and the Add element in FolderSync command responses.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3916,
                            @"[In ServerId(FolderSync)] Each Update element, each Delete element, and each Add element included in a FolderSync response MUST contain one ServerId element.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2581,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response, the parent element is Delete (section 2.2.3.42.1).");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                           2582,
                           @"[In ServerId(FolderSync)] None [Element ServerId in FolderSync command response has no child element.]");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                           2583,
                           @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response,  the data type is string.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2584,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response, the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();
                        #endregion
                    }
                }
                #endregion

                #region Capture code for Update(FolderSync)
                if (folderSyncResponse.ResponseData.Changes.Update != null && folderSyncResponse.ResponseData.Changes.Update.Length > 0)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2879");

                    // If the schema validation result is true and Update is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        2879,
                        @"[In Update] Element Update in FolderSync command response (section 2.2.2.4), the parent element is Changes (section 2.2.3.25).");

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

                    // If the schema validation result is true and Update is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        2880,
                        @"[In Update] Element Update in FolderSync command response (section 2.2.2.4), the child elements are ServerId (section 2.2.3.156.3), ParentId (section 2.2.3.123.2), DisplayName (section 2.2.3.47.3), Type (section 2.2.3.176.3).");

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

                    // If the schema validation result is true and Update is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        2881,
                        @"[In Update] Element Update in FolderSync command response (section 2.2.2.4), the data type is container ([MS-ASDTYPE] section 2.2).");

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

                    // If the schema validation result is true and Update is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        2882,
                        @"[In Update] Element Update in FolderSync command response (section 2.2.2.4), the number allowed is 0...N (optional).");

                    this.VerifyContainerDataType();

                    foreach (FolderSyncChangesUpdate folderSyncChangesUpdate in folderSyncResponse.ResponseData.Changes.Update)
                    {
                        #region Capture code for ServerId
                        Site.Assert.IsNotNull(folderSyncChangesUpdate.ServerId, "The ServerId(FolderSync) should not be null.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3911,
                            @"[In ServerId(FolderSync)] The ServerId element is a required child element of the Update element, the Delete element, and the Add element in FolderSync command responses.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3916,
                            @"[In ServerId(FolderSync)] Each Update element, each Delete element, and each Add element included in a FolderSync response MUST contain one ServerId element.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                           2577,
                           @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response (section 2.2.2.4), the parent element is Update (section 2.2.3.177).");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2578,
                            @"[In ServerId(FolderSync)] None [Element ServerId in FolderSync command response (section 2.2.2.4) has no child element.]");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2579,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response (section 2.2.2.4), the data type is string ([MS-ASDTYPE] section 2.7).");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                             2580,
                             @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response (section 2.2.2.4), the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();
                        #endregion

                        #region Capture code for ParentId(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesUpdate.ParentId, "The ParentId(FolderSync) should not be null.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3622,
                            @"[In ParentId(FolderSync)] The ParentId element is a required child element of the Update element in FolderSync command responses that specifies the server ID of the parent folder of the folder on the server that has been updated.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3625,
                            @"[In ParentId(FolderSync)] Each Update element included in a FolderSync response MUST contain one ParentId element.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2332,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response (section 2.2.2.4), the parent element is Update (section 2.2.3.177).");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2333,
                            @"[In ParentId(FolderSync)] None [Element ParentId in FolderSync command response (section 2.2.2.4) has no child element.]");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2334,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response (section 2.2.2.4), the data type is string ([MS-ASDTYPE] section 2.7).");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2335,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response (section 2.2.2.4), the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();

                        #endregion

                        #region Capture code for DisplayName(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesUpdate.DisplayName, "The DisplayName(FolderSync) should not be null.");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2195,
                            @"[In DisplayName(FolderSync)] The DisplayName element is a required child element of the Update element and the Add element in FolderSync command responses that specifies the name of the folder that is shown to the user.");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1530,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response (section 2.2.2.4), the parent element is Update (section 2.2.3.177).");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1531,
                            @"[In DisplayName(FolderSync)] None [Element DisplayName in FolderSync command response (section 2.2.2.4) has no child element .]");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1532,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response (section 2.2.2.4), the data  type is string ([MS-ASDTYPE] section 2.7).");

                        this.VerifyStringDataType();

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1533,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response (section 2.2.2.4), the number allowed is 1…1 (required).");

                        #endregion

                        #region Capture code for Type(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesUpdate.Type, "The Type(FolderSync) should not be null.");

                        int type;

                        Site.Assert.IsTrue(int.TryParse(folderSyncChangesUpdate.Type, out type), "The Type element should be an integer.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            4663,
                            @"[In Type(FolderSync)] The Type element is a required child element of the Update element and the Add element in FolderSync command responses that specifies the type of the folder that was updated (renamed or moved) or added on the server.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            4665,
                            @"[In Type(FolderSync)] Each Update element and each Add element included in a FolderSync response MUST contain one Type element.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2867,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response (section 2.2.2.4), the parent element is Update (section 2.2.3.177).");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2868,
                            @"[In Type(FolderSync)] None [Element Type in FolderSync command response (section 2.2.2.4) has no child element.]");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2870,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response (section 2.2.2.4), the number allowed is 1…1 (required).");

                        // Verify MS-ASCMD requirement: MS-ASCMD_R2869
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2869");

                        // Verify MS-ASCMD requirement: MS-ASCMD_R2869
                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2869,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response (section 2.2.2.4), the data type is integer ([MS-ASDTYPE] section 2.6).");

                        Common.VerifyActualValues("Type(FolderSync)", new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" }, folderSyncChangesUpdate.Type, this.Site);

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

                        // Verify MS-ASCMD requirement: MS-ASCMD_R4666
                        // If above Common.VerifyActualValues method is not failed, this requirement can be verified.
                        Site.CaptureRequirement(
                            4666,
                            @"[In Type(FolderSync)] The folder type values [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] are listed in the following table.");

                        this.VerifyIntegerDataType();
                        #endregion
                    }
                }
                #endregion

                #region Capture code for Add(FolderSync)
                if (folderSyncResponse.ResponseData.Changes.Add != null && folderSyncResponse.ResponseData.Changes.Add.Length > 0)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R1031");

                    // If the schema validation result is true and Add(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1031,
                        @"[In Add(FolderSync)] Element Add in FolderSync command response (section 2.2.2.4), the parent element is Changes (section 2.2.3.25).");

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

                    // If the schema validation result is true and Add(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1032,
                        @"[In Add(FolderSync)] Element Add in FolderSync command response (section 2.2.2.4), the child elements are ServerId (section 2.2.3.156.3), ParentId (section 2.2.3.123.2), DisplayName (section 2.2.3.47.3), Type (section 2.2.3.176.3).");

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

                    // If the schema validation result is true and Add(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1033,
                        @"[In Add(FolderSync)] Element Add in FolderSync command response (section 2.2.2.4), the data type is container ([MS-ASDTYPE] section 2.2).");

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

                    // If the schema validation result is true and Add(FolderSync) is not null, this requirement can be verified.
                    Site.CaptureRequirement(
                        1034,
                        @"[In Add(FolderSync)] Element Add in FolderSync command response (section 2.2.2.4), the number allowed is 0...N (optional).");

                    this.VerifyContainerDataType();

                    foreach (FolderSyncChangesAdd folderSyncChangesAdd in folderSyncResponse.ResponseData.Changes.Add)
                    {
                        #region Capture code for ServerId(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesAdd.ServerId, "The ServerId(FolderSync) should not be null.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3911,
                            @"[In ServerId(FolderSync)] The ServerId element is a required child element of the Update element, the Delete element, and the Add element in FolderSync command responses.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            3916,
                            @"[In ServerId(FolderSync)] Each Update element, each Delete element, and each Add element included in a FolderSync response MUST contain one ServerId element.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2585,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response, the parent element is Add (section 2.2.3.7.1).");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2586,
                            @"[In ServerId(FolderSync)] None [Element ServerId in FolderSync command response has no child element.]");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2587,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response, the  data type is string.");

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

                        // If the schema validation result is true and ServerId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2588,
                            @"[In ServerId(FolderSync)] Element ServerId in FolderSync command response, the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();
                        #endregion

                        #region Capture code for ParentId(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesAdd.ParentId, "The ParentId(FolderSync) should not be null.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            5884,
                            @"[In ParentId(FolderSync)] The ParentId element is a required child element of the Add element in FolderSync command responses that specifies the server ID of the parent folder of the folder on the server that has been added.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            5885,
                            @"[In ParentId(FolderSync)] Each Add element included in a FolderSync response MUST contain one ParentId element.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2336,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response, the parent element is Add (section 2.2.3.7.1).");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2337,
                            @"[In ParentId(FolderSync)] None [Element ParentId in FolderSync command response has no child element.]");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2338,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response, the data type is string.");

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

                        // If the schema validation result is true and ParentId(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2339,
                            @"[In ParentId(FolderSync)] Element ParentId in FolderSync command response, the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();

                        #endregion

                        #region Capture code for DisplayName(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesAdd.DisplayName, "The DisplayName(FolderSync) should not be null.");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2195,
                            @"[In DisplayName(FolderSync)] The DisplayName element is a required child element of the Update element and the Add element in FolderSync command responses that specifies the name of the folder that is shown to the user.");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1539,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response, the parent element is Add (section 2.2.3.7.1).");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1540,
                            @"[In DisplayName(FolderSync)] None [Element DisplayName in FolderSync command response has no child element.]");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1541,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response, the data type is string.");

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

                        // If the schema validation result is true and DisplayName(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            1542,
                            @"[In DisplayName(FolderSync)] Element DisplayName in FolderSync command response, the number allowed is 1…1 (required).");

                        this.VerifyStringDataType();
                        #endregion

                        #region Capture code for Type(FolderSync)
                        Site.Assert.IsNotNull(folderSyncChangesAdd.Type, "The Type(FolderSync) should not be null.");

                        int type;

                        Site.Assert.IsTrue(int.TryParse(folderSyncChangesAdd.Type, out type), "The Type element should be an integer.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            4663,
                            @"[In Type(FolderSync)] The Type element is a required child element of the Update element and the Add element in FolderSync command responses that specifies the type of the folder that was updated (renamed or moved) or added on the server.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            4665,
                            @"[In Type(FolderSync)] Each Update element and each Add element included in a FolderSync response MUST contain one Type element.");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2871,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response, the parent element is Add (section 2.2.3.7.1).");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2872,
                            @"[In Type(FolderSync)] None [Element Type in FolderSync command response has no child element.]");

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

                        // If the schema validation result is true and Type(FolderSync) is not null, this requirement can be verified.
                        Site.CaptureRequirement(
                            2874,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response, the number allowed is 1…1 (required).");

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

                        // Verify MS-ASCMD requirement: MS-ASCMD_R2873
                        Site.CaptureRequirement(
                            2873,
                            @"[In Type(FolderSync)] Element Type in FolderSync command response, the data type is integer.");

                        Common.VerifyActualValues("Type(FolderSync)", new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" }, folderSyncChangesAdd.Type, this.Site);

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

                        // Verify MS-ASCMD requirement: MS-ASCMD_R4666
                        // If above Common.VerifyActualValues method is not failed, this requirement can be verified.
                        Site.CaptureRequirement(
                          4666,
                            @"[In Type(FolderSync)] The folder type values [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] are listed in the following table.");

                        this.VerifyIntegerDataType();

                        #endregion
                    }
                }
                #endregion
            }
            #endregion
        }
예제 #33
0
        /// <summary>
        /// Call FolderSync command and get the response.
        /// </summary>
        /// <returns>The response of FolderSync command.</returns>
        protected FolderSyncResponse CallFolderSyncCommand()
        {
            // Create FolderSync command request.
            string folderSyncRequest = Common.CreateFolderSyncRequest("0").GetRequestDataSerializedXML();

            // Call FolderSync command by HTTP POST.
            SendStringResponse folderSyncResponseString = this.HTTPAdapter.HTTPPOST(CommandName.FolderSync, null, folderSyncRequest);

            // Check the command is executed successfully.
            this.CheckResponseStatus(folderSyncResponseString.ResponseDataXML);

            // Convert SendStringResponse to FolderSyncResponse.
            FolderSyncResponse folderSyncResponse = new FolderSyncResponse
            {
                ResponseDataXML = folderSyncResponseString.ResponseDataXML,
                Headers = folderSyncResponseString.Headers
            };

            folderSyncResponse.DeserializeResponseData();

            return folderSyncResponse;
        }
예제 #34
0
        /// <summary>
        /// Get the server ID for the given default folder type in the actual FolderSyncResponse.
        /// </summary>
        /// <param name="folderSyncResponse">A FolderSyncResponse returned by previous ActiveSync FolderSync operation.</param>
        /// <param name="folderType">Specify the default folder type.</param>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>Returns the server ID associated with the specified default folder type.</returns>
        public static string GetDefaultFolderServerId(FolderSyncResponse folderSyncResponse, FolderType folderType, ITestSite site)
        {
            site.Assert.IsNotNull(folderSyncResponse, "The FolderSyncResponse should not be null.");
            site.Assert.IsNotNull(folderSyncResponse.ResponseData, "The FolderSyncResponse.ResponseData should not be null.");
            site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes, "The FolderSyncResponse.ResponseData.Changes should not be null.");
            site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes.Add, "The FolderSyncResponse.ResponseData.Changes.Add should not be null.");

            string serverId = null;

            foreach (FolderSyncChangesAdd addResponse in folderSyncResponse.ResponseData.Changes.Add)
            {
                int type = (int)folderType;
                if (string.Equals(addResponse.Type, type.ToString(), StringComparison.CurrentCultureIgnoreCase))
                {
                    serverId = addResponse.ServerId;
                    break;
                }
            }

            return serverId;
        }