Esempio n. 1
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
        }
Esempio n. 2
0
 /// <summary>
 /// Create a MoveItemsRequest instance using specified MoveItemsMove array
 /// </summary>
 /// <param name="items">Specified the MoveItemsMove array</param>
 /// <returns>A MoveItemsRequest instance</returns>
 public static MoveItemsRequest CreateMoveItemsRequest(Request.MoveItemsMove[] items)
 {
     MoveItemsRequest request = new MoveItemsRequest();
     Request.MoveItems requestData = new Request.MoveItems { Move = items };
     request.RequestData = requestData;
     return request;
 }
Esempio n. 3
0
 /// <summary>
 /// Create an empty MoveItemsRequest instance
 /// </summary>
 /// <returns>A MoveItemsRequest instance</returns>
 public static MoveItemsRequest CreateMoveItemsRequest()
 {
     MoveItemsRequest request = new MoveItemsRequest();
     Request.MoveItems requestData = new Request.MoveItems();
     request.RequestData = requestData;
     return request;
 }
        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
        }
        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
        }
Esempio n. 6
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
        }