/// <summary>
        /// Move items to the specific folder.
        /// </summary>
        /// <param name="serverIds">The ServerId of the items to move.</param>
        /// <param name="sourceFolder">The CollectionId of the source folder.</param>
        /// <param name="destinationFolder">The CollectionId of the destination folder.</param>
        /// <returns>The response of MoveItems command.</returns>
        protected MoveItemsResponse CallMoveItemsCommand(Collection <string> serverIds, string sourceFolder, string destinationFolder)
        {
            // Move the items from sourceFolder to destinationFolder.
            List <Request.MoveItemsMove> moveItems = new List <Request.MoveItemsMove>();

            foreach (string serverId in serverIds)
            {
                Request.MoveItemsMove move = new Request.MoveItemsMove
                {
                    SrcFldId = sourceFolder,
                    DstFldId = destinationFolder,
                    SrcMsgId = serverId
                };

                moveItems.Add(move);
            }

            MoveItemsRequest moveItemsRequest = Common.CreateMoveItemsRequest(moveItems.ToArray());

            // Call MoveItems command to move the items.
            MoveItemsResponse moveItemsResponse = this.CONAdapter.MoveItems(moveItemsRequest);

            Site.Assert.AreEqual <int>(serverIds.Count, moveItemsResponse.ResponseData.Response.Length, "The count of Response element should be {0}, actual {1}.", serverIds.Count, moveItemsResponse.ResponseData.Response.Length);
            foreach (Response.MoveItemsResponse response in moveItemsResponse.ResponseData.Response)
            {
                Site.Assert.AreEqual <int>(3, int.Parse(response.Status), "If the MoveItems command executes successfully, the Status should be 3, actual {0}.", response.Status);
            }

            return(moveItemsResponse);
        }
Beispiel #2
0
        public void MSASCMD_S10_TC05_MoveItems_Status4()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to Inbox folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.InboxCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4219
            Site.CaptureRequirementIfAreEqual <int>(
                4,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4219,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 4 is] The client supplied a destination folder that is the same as the source.");
            #endregion
        }
Beispiel #3
0
        public void MSASCMD_S10_TC04_MoveItems_Status2()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to an invalid destination folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, "Invalid DstFldId");
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4212
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4212,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 2 is] The destination folder collection ID (CollectionId element value) is not recognized by the server, possibly because the source folder has been deleted.");
            #endregion
        }
        public void MSASCMD_S21_TC04_CommonStatusCode_105()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The DstFldId element 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 User2 sends mail to User1 and do FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId          = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to recipient information cache.
            Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.RecipientInformationCacheCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            MoveItemsRequest  moveItemsRequest  = Common.CreateMoveItemsRequest(new Request.MoveItemsMove[] { moveItemsMove });
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4821
            Site.CaptureRequirementIfAreEqual <int>(
                105,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4821,
                @"[In Common Status Codes] [The meaning of the status value 105 is] The request contains a combination of parameters that is invalid.");
        }
        internal string MoveItem(string messageId, string sourceFolderId, string destinationFolderId)
        {
            MoveItemsRequest moveItemsRequest = EasRequestGenerator.CreateMoveRequestForMessages(new string[]
            {
                messageId
            }, sourceFolderId, destinationFolderId);
            MoveItemsResponse moveItemsResponse = this.MoveItems(moveItemsRequest);

            return(moveItemsResponse.Responses[0].DstMsgId);
        }
Beispiel #6
0
        public void MSASCON_S04_TC01_MoveItems_Move()
        {
            #region Create a conversation and get the created conversation item.
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Call MoveItems command to move the conversation from Inbox folder to SentItems folder.
            MoveItemsResponse moveItemsResponse = this.CallMoveItemsCommand(sourceConversationItem.ServerId, User1Information.InboxCollectionId, User1Information.SentItemsCollectionId);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.SentItemsCollectionId, conversationSubject, false);

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

            // Verify MS-ASCON requirement: MS-ASCON_R218
            Site.CaptureRequirementIfIsNotNull(
                moveItemsResponse.ResponseData,
                218,
                @"[In Processing a MoveItems Command] The server sends a MoveItems command response, as specified in [MS-ASCMD] section 2.2.1.12.");
            #endregion

            #region Synchronize emails in the Inbox folder and Sent Items folder after conversation moved.
            // Call Sync command to get the emails of the conversation in Inbox folder.
            DataStructures.Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);

            // Get the emails of the conversation in Sent Items folder.
            ConversationItem destinationCoversationItem = this.GetConversationItem(User1Information.SentItemsCollectionId, sourceConversationItem.ConversationId);

            // If the emails of the conversation in Inbox folder could not be found and the emails count of the conversation in Sent Items folder is equal to Inbox folder, then the original emails have been moved.
            bool allEmailsMoved = syncResult == null && sourceConversationItem.ServerId.Count == destinationCoversationItem.ServerId.Count;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R170");
            Site.Log.Add(LogEntryKind.Debug, "The count of the emails of the specified conversation in Inbox folder is {0}, while it is {1} in Sent Items folder.", sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R170
            Site.CaptureRequirementIfIsTrue(
                allEmailsMoved,
                170,
                @"[In Moving a Conversation from the Current Folder] When a conversation is moved from the current folder to another folder, all e-mail messages that are in the conversation are moved from the current folder to the destination folder.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R217");
            Site.Log.Add(LogEntryKind.Debug, "The count of the emails of the specified conversation in Inbox folder is {0}, while it is {1} in Sent Items folder.", sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R217
            Site.CaptureRequirementIfIsTrue(
                allEmailsMoved,
                217,
                @"[In Processing a MoveItems Command] When the server receives a request to move a conversation, as specified in section 3.1.4.5, the server moves all e-mail messages that are in the conversation from the current folder to the specified destination folder.");
            #endregion
        }
Beispiel #7
0
        /// <summary>
        /// Moves an item or items from one folder on the server to another.
        /// </summary>
        /// <param name="moveItemsRequest">A MoveItemsRequest object that contains the request information.</param>
        /// <returns>MoveItems command response.</returns>
        public MoveItemsResponse MoveItems(MoveItemsRequest moveItemsRequest)
        {
            MoveItemsResponse moveItemsResponse = this.activeSyncClient.MoveItems(moveItemsRequest);

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

            // Verify related requirements.
            this.VerifyCommonRequirements();
            this.VerifyWBXMLCapture();

            return(moveItemsResponse);
        }
        /// <summary>
        /// Moves an item or items from one folder to another on the server..
        /// </summary>
        /// <param name="request">A MoveItemsRequest object that contains the request information.</param>
        /// <returns>MoveItems command response</returns>
        public MoveItemsResponse MoveItems(MoveItemsRequest request)
        {
            MoveItemsResponse response = this.activeSyncClient.MoveItems(request);

            this.VerifyTransportRequirements();
            if (response.ResponseData.Response != null)
            {
                this.VerifyWBXMLCapture(CommandName.MoveItems, response);
                this.VerifyMoveItemsCommand(response);
            }

            return(response);
        }
Beispiel #9
0
        /// <summary>
        /// This method is used to check the response of MoveItems command.
        /// </summary>
        /// <param name="moveItemsResponse">The response of MoveItems command.</param>
        /// <param name="expectedResponseNumber">The expected number of Response element in MoveItems response</param>
        private void CheckMoveItemsResponse(MoveItemsResponse moveItemsResponse, int expectedResponseNumber)
        {
            Site.Assert.IsNotNull(moveItemsResponse.ResponseData.Response, "The Response elements in MoveItems Response should be not null.");
            Site.Assert.AreEqual <int>(
                expectedResponseNumber,
                moveItemsResponse.ResponseData.Response.Length,
                "There should be {0} Response element(s) in MoveItems Response.",
                expectedResponseNumber);

            for (int i = 0; i < expectedResponseNumber; i++)
            {
                Site.Assert.IsNotNull(moveItemsResponse.ResponseData.Response[i], "The No.{0} Response element in MoveItems Response should be not null.", i + 1);
            }
        }
Beispiel #10
0
        public void MSASCMD_S10_TC07_MoveItems_Status103()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5671, this.Site), "Exchange 2007 does not limit the number of elements in command requests.");

            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string syncKeyInbox = this.LastSyncKey;
            string serverId     = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server, and get the SyncKey
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.DeletedItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            Request.MoveItems moveItems = new Request.MoveItems();
            moveItems.Move = new Request.MoveItemsMove[1001];
            for (int i = 0; i <= 1000; i++)
            {
                moveItems.Move[i] = moveItemsMove;
            }

            MoveItemsRequest  request     = new MoveItemsRequest();
            Request.MoveItems requestData = moveItems;
            request.RequestData = requestData;

            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(request);

            this.Site.CaptureRequirementIfAreEqual <int>(
                103,
                int.Parse(moveItemsResponse.ResponseData.Status),
                5653,
                @"[In Limiting Size of Command Requests] In MoveItems (section 2.2.2.11) command request, when the limit value of Move element is bigger than 1000 (minimum 1, maximum 2,147,483,647), the error returned by server is Status element (section 2.2.3.167.9) value of 103.");
            #endregion
        }
Beispiel #11
0
        public void MSASCMD_S10_TC03_MoveItems_Status1_InvalidSrcMsgId()
        {
            #region User2 calls SendMail command to send a mail to User1.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region User1 calls Sync command to synchronize changes of Inbox folder and get the ServerId of sent email item and the latest SyncKey.
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string serverId = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region User1 calls MoveItems command with the received email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);
            #endregion

            #region User1 calls MoveItems command with the received email item's ServerId again to move the email item from Inbox folder to DeletedItems folder after the email item is not exist in Inbox folder.
            moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4208
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4208,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 1 is] Or, the item with the Item ID (SrcMsgId element (section 2.2.3.160)) has been previously moved out of the folder with the Folder ID (SrcFldId element (section 2.2.3.159)).");
            #endregion
        }
Beispiel #12
0
        public void MSASCMD_S10_TC02_MoveItems_Status1_InvalidSrcFldId()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from an invalid source folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, "Invalid SrcFldId", this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4201
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4201,
                @"[In Status(MoveItems)] If the command failed, Status contains a code indicating the type of failure.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4207
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4207,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 1 is] The source folder collection ID (CollectionId element (section 2.2.3.30.5) value) is not recognized by the server, possibly because the source folder has been deleted.");
            #endregion
        }
Beispiel #13
0
        public void MSASCMD_S11_TC06_Ping_ChangesOccurred()
        {
            #region User2 calls CreateFolder command to create two sub folders in user Inbox folder
            this.SwitchUser(this.User2Information);
            int           folderCreateCount = 2;
            List <string> folderIDList      = new List <string>();
            for (int folderIndex = 0; folderIndex < folderCreateCount; folderIndex++)
            {
                string folderID = this.CreateFolder((byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate", (uint)(folderIndex + 1)), this.User2Information.InboxCollectionId);
                folderIDList.Add(folderID);

                // Sync the new created folder
                this.SyncChanges(folderID);
            }

            // Record created folders
            TestSuiteBase.RecordCaseRelativeFolders(this.User2Information, folderIDList.ToArray());
            #endregion

            #region User1 calls SendMail command to send one mail to user2, then user2 move the email to one of new created folder
            this.SwitchUser(this.User1Information);
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            // User2 calls Sync command to get the email, then moves to sub folder
            this.SwitchUser(this.User2Information);
            SyncResponse syncInboxFolderResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject);
            string       emailItemServerID       = TestSuiteBase.FindServerId(syncInboxFolderResponse, "Subject", emailSubject);

            // User2 calls MoveItems command to move the email item from Inbox folder to one of created subfolder
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(emailItemServerID, this.User2Information.InboxCollectionId, folderIDList[0]);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);
            Site.Assert.AreEqual(3, Convert.ToInt32(moveItemsResponse.ResponseData.Response[0].Status), " If MoveItems command executes successfully, server should return status 3");
            #endregion

            #region Resend ping request to monitor the changes in sub folders and record duration
            DateTime     startTime    = DateTime.Now;
            PingRequest  pingRequest  = CreateMultiFolderPingRequest(folderIDList, Request.PingFolderClass.Email);
            PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest);
            DateTime     endTime      = DateTime.Now;
            TimeSpan     duration     = endTime - startTime;
            #endregion

            #region Verify Requirements MS-ASCMD_R306, MS-ASCMD_R4235, MS-ASCMD_R4236, MS-ASCMD_R5714, MS-ASCMD_R5636
            // Ping command is used to monitor specified folder changes, if changes happened in the folders, server will return status 2 in Ping response, then MS-ASCMD_R306, MS-ASCMD_R4235, MS-ASCMD_R4236, MS-ASCMD_R5636 are verified.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R306");

            // Verify MS-ASCMD requirement: MS-ASCMD_R306
            Site.CaptureRequirementIfIsNotNull(
                pingResponse.ResponseData.Status,
                306,
                @"[In Ping] The Ping command is used to request that the server monitor specified folders for changes that would require the client to resynchronize.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4235
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                4235,
                @"[In Status(Ping)] [When the scope is] Global, [the meaning of the status value] 2 [is] Changes occurred in at least one of the monitored folders.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5636
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                5636,
                @"[In Monitoring Folders for New Items] The server uses the last airsync:SyncKey element (as specified in section 2.2.3.166.4) value returned to the client when determining what to report in the Ping response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4236
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                4236,
                @"[In Status(Ping)] [When the scope is] Global, [the meaning of the status value 2 is] The response specifies the changed folders.");

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

                // Verify MS-ASCMD requirement: MS-ASCMD_R5714
                Site.CaptureRequirementIfIsTrue(
                    pingRequest.RequestData.HeartbeatInterval != null && int.Parse(pingResponse.ResponseData.Status) == 2 && duration.Milliseconds < Convert.ToInt32(pingRequest.RequestData.HeartbeatInterval) * 1000,
                    5714,
                    @"[In Appendix A: Product Behavior] The body of the request contains an interval of time that specifies how long the implementation does wait before responding if no new items are added to the specified folders. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion

            #region Send ping request with empty HeartbeatInterval element, if server returns status equal to 2 then MS-ASCMD_R5836 is verified.
            pingRequest = CreateMultiFolderPingRequest(folderIDList, Request.PingFolderClass.Email);
            pingRequest.RequestData.HeartbeatInterval = null;
            pingResponse = this.CMDAdapter.Ping(pingRequest);
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5836
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                5836,
                @"[In Status(Ping)] [When the scope is Global], The server saves the heartbeat interval value (section 2.2.3.79.1), so only the folder list is required on subsequent requests.");
        }
Beispiel #14
0
        public void MSASCMD_S10_TC01_MoveItems_Success()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string syncKeyInbox = this.LastSyncKey;
            string serverId     = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server, and get the SyncKey
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4217
            Site.CaptureRequirementIfAreEqual <string>(
                "3",
                moveItemsResponse.ResponseData.Response[0].Status,
                4217,
                @"[In Status(MoveItems)] [When the scope is Global], [the cause of the status value 3 is] Server successfully completed command.");

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

            Site.CaptureRequirementIfAreEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].SrcMsgId,
                3977,
                "[In SrcMsgId] The SrcMsgId element is a required child element of the Response element in MoveItems command responses that specifies the server ID of the item that was moved.");

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

            Site.CaptureRequirementIfAreNotEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].DstMsgId,
                285,
                "[In MoveItems] The MoveItems command moves an item or items from one folder on the server to another [folder].");

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

            Site.CaptureRequirementIfAreNotEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].DstMsgId,
                290,
                "[In MoveItems] An item that has been successfully moved to a different folder can be assigned a new server ID by the server.");
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder and DeletedItems folder in User1's mailbox, and record the item changes for clean up
            bool isItemDeleted = this.CheckDeleteInSyncResponse(syncKeyInbox, this.User1Information.InboxCollectionId, serverId);
            Site.Assert.IsTrue(isItemDeleted, "The item with ServerId: {0} should be deleted for collection ID: {0}.", serverId, this.User1Information.InboxCollectionId);
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);

            bool isItemAdded = this.CheckAddInSyncResponse(syncKeyDeletedItems, this.User1Information.DeletedItemsCollectionId, subject);

            Site.Assert.IsTrue(isItemAdded, "The item with ServerId: {0} should be added for Deleted Items folder", serverId);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R289
            // This requirement can be captured directly after previous step when synchronize changes of Inbox folder, there is a Delete operation,
            // and synchronize changes of DeletedItems folder, there is an Add operation.
            Site.CaptureRequirement(
                289,
                @"[In MoveItems] When items are moved between folders on the server, the client receives Delete (section 2.2.3.42) and Add (section 2.2.3.7) operations the next time the client synchronizes the affected folders.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5879
            // This requirement can be captured directly after previous step when synchronize changes of Inbox folder, there is a Delete operation on the source item
            // and synchronize changes of DeletedItems folder, there is an Add operation on the item with same subject.
            Site.CaptureRequirement(
                5879,
                @"[In SrcFldId] [The SrcFldId element] specifies the server ID of the source folder (that is, the folder that contains the items to be moved).");
            #endregion
        }
Beispiel #15
0
        public void MSASCMD_S10_TC06_MoveItems_Status5()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       syncKeyInbox      = this.LastSyncKey;
            string       serverId          = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server.
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method Sync to synchronize changes of SentItems folder in User1's mailbox between the client and the server.
            this.SyncChanges(this.User1Information.SentItemsCollectionId);
            string syncKeySentItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId and two different destination collection IDs to move the same email item from Inbox folder to two different folders, and check if there is one response with Status element equal to 5
            MoveItemsRequest             moveItemsRequest = new MoveItemsRequest();
            Request.MoveItems            moveItems        = new Request.MoveItems();
            List <Request.MoveItemsMove> moveItemList     = new List <Request.MoveItemsMove>();

            Request.MoveItemsMove moveItemsMoveOne = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.DeletedItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };
            moveItemList.Add(moveItemsMoveOne);

            Request.MoveItemsMove moveItemsMoveTwo = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.SentItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            moveItemList.Add(moveItemsMoveTwo);

            moveItems.Move = moveItemList.ToArray();

            moveItemsRequest.RequestData = moveItems;

            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 2);

            bool hasStatus5 = false;
            bool hasStatus3 = false;
            foreach (Response.MoveItemsResponse response in moveItemsResponse.ResponseData.Response)
            {
                if (int.Parse(response.Status) == 5)
                {
                    hasStatus5 = true;
                    Site.Log.Add(LogEntryKind.Debug, "There should be at least one Status element equal to 5 in MoveItems response");
                }
                else if (int.Parse(response.Status) == 3)
                {
                    hasStatus3 = true;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4222
            Site.CaptureRequirementIfIsTrue(
                hasStatus5,
                4222,
                @"[In Status(MoveItems)] [When the scope is Global], [the cause of the status value 5 is] More than one DstFldId element (section 2.2.3.47.2) was included in the request [or an item with that name already exists].");

            #endregion

            #region Call method Sync to synchronize changes of Inbox folder, DeletedItems and SentItems folder in User1's mailbox, and record the item changes in case there is another success response.
            if (hasStatus3)
            {
                bool isItemDeleted = this.CheckDeleteInSyncResponse(syncKeyInbox, this.User1Information.InboxCollectionId, serverId);
                Site.Assert.IsTrue(isItemDeleted, "The item with ServerId: {0} should be deleted for collection ID: {1}.", serverId, this.User1Information.InboxCollectionId);
                TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);

                bool isItemAddedDeleteItems = this.CheckAddInSyncResponse(syncKeyDeletedItems, this.User1Information.DeletedItemsCollectionId, subject);
                if (isItemAddedDeleteItems)
                {
                    Site.Log.Add(LogEntryKind.Debug, "The item with ServerId: {0} has been added for Deleted Items folder", serverId);
                    TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);
                }

                bool isItemAddedSentItems = this.CheckAddInSyncResponse(syncKeySentItems, this.User1Information.SentItemsCollectionId, subject);
                if (isItemAddedSentItems)
                {
                    Site.Log.Add(LogEntryKind.Debug, "The item with ServerId: {0} has been added for Sent Items folder", serverId);
                    TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.SentItemsCollectionId, subject);
                }

                Site.Assert.AreNotEqual <bool>(
                    isItemAddedDeleteItems,
                    isItemAddedSentItems,
                    "If the source item is moved successfully, it should exist in either Deleted Items folder or Sent Items folder, but should not exist in both of these folders.");
            }
            #endregion
        }