Exemplo n.º 1
0
        public void MSASCON_S01_TC08_Sync_Status164()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call sync command with BodyPartPreference element and set the Type element to 3
            this.SwitchUser(this.User1Information, false);

            // Check whether the mail has been received.
            this.SyncEmail(subject, User1Information.InboxCollectionId, true, null, null);

            Request.BodyPartPreference bodyPartPreference = new Request.BodyPartPreference()
            {
                Type = 3,
            };

            // Call initial Sync command.
            SyncRequest syncRequest = Common.CreateInitialSyncRequest(User1Information.InboxCollectionId);
            SyncStore   syncStore   = this.CONAdapter.Sync(syncRequest);

            syncRequest = TestSuiteHelper.GetSyncRequest(User1Information.InboxCollectionId, syncStore.SyncKey, bodyPartPreference, null, false);
            syncStore   = this.CONAdapter.Sync(syncRequest);
            this.VerifyMessagePartStatus164(syncStore.Status);
            #endregion
        }
Exemplo n.º 2
0
        public void MSASCON_S03_TC07_ItemOperations_Status164()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call ItemOperations command with BodyPartPreference element and set the Type element to 3
            this.SwitchUser(this.User1Information, false);

            DataStructures.Sync syncItem           = this.SyncEmail(subject, User1Information.InboxCollectionId, true, null, null);
            BodyPartPreference  bodyPartPreference = new BodyPartPreference()
            {
                Type = 3,
            };

            ItemOperationsRequest  itemOperationsRequest  = TestSuiteHelper.GetItemOperationsRequest(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, null);
            ItemOperationsResponse itemOperationsResponse = this.CONAdapter.ItemOperations(itemOperationsRequest);
            Site.Assert.AreEqual("1", itemOperationsResponse.ResponseData.Status, "The ItemOperations operation should be success.");
            this.VerifyMessagePartStatus164(byte.Parse(itemOperationsResponse.ResponseData.Response.Fetch[0].Status));
            #endregion
        }
Exemplo n.º 3
0
        public void MSASCON_S05_TC03_Search_Status164()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            if (Common.IsRequirementEnabled(220, this.Site))
            {
                #region Call Search command with BodyPartPreference element and set the Type element to 3
                this.SwitchUser(this.User1Information, false);

                DataStructures.Sync syncItem           = this.SyncEmail(subject, User1Information.InboxCollectionId, true, null, null);
                BodyPartPreference  bodyPartPreference = new BodyPartPreference()
                {
                    Type = 3,
                };

                SearchRequest searchRequest            = TestSuiteHelper.GetSearchRequest(syncItem.Email.ConversationId, bodyPartPreference, null);
                DataStructures.SearchStore searchStore = this.CONAdapter.Search(searchRequest, false, 0);
                this.VerifyMessagePartStatus164(byte.Parse(searchStore.StoreStatus));
                #endregion
            }
        }
Exemplo n.º 4
0
        public void MSASCON_S03_TC01_ItemOperations_Ignore()
        {
            #region Create a conversation and get the created conversation item
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Call ItemOperations command to ignore the conversation
            // Move the created conversation from Inbox folder to Deleted Items folder with setting MoveAlways element.
            ItemOperationsResponse itemOperationResponse = this.ItemOperationsMove(sourceConversationItem.ConversationId, User1Information.DeletedItemsCollectionId, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.DeletedItemsCollectionId, conversationSubject, false);

            bool isVerifiedR214 = itemOperationResponse.ResponseData.Response.Move[0].Status != null && itemOperationResponse.ResponseData.Response.Move[0].ConversationId != null;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R214");
            Site.Log.Add(LogEntryKind.Debug, "The value of the Status element is {0}, and the value of ConversationId element is {1}.", itemOperationResponse.ResponseData.Response.Move[0].Status, itemOperationResponse.ResponseData.Response.Move[0].ConversationId);

            // Verify MS-ASCON requirement: MS-ASCON_R214
            Site.CaptureRequirementIfIsTrue(
                isVerifiedR214,
                214,
                @"[In Ignoring a Conversation] The server sends an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) that includes the itemoperations:Status element, as specified in section 2.2.2.10, and the itemoperations:ConversationId element (section 2.2.2.3.1).");

            Site.Assert.AreEqual("1", itemOperationResponse.ResponseData.Response.Move[0].Status, "The move operation should be success.");
            #endregion

            #region User1 synchronizes messages in the Inbox folder and Deleted Items folder after conversation moved
            DataStructures.Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "No conversation messages should not be found in Inbox folder.");

            ConversationItem destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count, "All conversation messages should be moved to Deleted Items folder.");
            #endregion

            #region User2 replies the received message to create a future e-mail message for that conversation.
            this.SwitchUser(this.User2Information, false);
            syncResult = this.SyncEmail(conversationSubject, User2Information.InboxCollectionId, true, null, null);

            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            // Smart reply the received email from User2 to User1.
            this.CallSmartReplyCommand(syncResult.ServerId, User2Information.InboxCollectionId, user2MailboxAddress, user1MailboxAddress, conversationSubject);

            // Switch the current user to User1.
            this.SwitchUser(this.User1Information, false);

            destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId, sourceConversationItem.ServerId.Count + 1);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count + 1, destinationCoversationItem.ServerId.Count, "The future message should be moved to Deleted Items folder.");

            // Check if the received email is in Inbox folder.
            syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "The future message should not be found in Inbox folder.");
            #endregion
        }
Exemplo n.º 5
0
        public void MSASCON_S05_TC01_Search()
        {
            #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 one item of the conversation from Inbox folder to SentItems folder.
            Collection <string> moveItems = new Collection <string> {
                sourceConversationItem.ServerId[0]
            };

            // Call MoveItems command to move one item of the conversation from Inbox folder to SentItems folder.
            this.CallMoveItemsCommand(moveItems, User1Information.InboxCollectionId, User1Information.SentItemsCollectionId);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.SentItemsCollectionId, conversationSubject, false);
            #endregion

            #region Call Search command to find the conversation.
            DataStructures.SearchStore searchResponse = this.CallSearchCommand(sourceConversationItem.ConversationId, 2, null, null);

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

            // Verify MS-ASCON requirement: MS-ASCON_R221
            // The Search command executed successfully, so this requirement can be captured.
            Site.CaptureRequirement(
                221,
                @"[In Processing a Search Command] The server sends a Search command response, as specified in [MS-ASCMD] section 2.2.2.14.");

            Site.Assert.AreEqual <int>(searchResponse.Results.Count, sourceConversationItem.ServerId.Count, "The count of the search result should be equal to the count of items in the conversation.");

            // If one of the found email is in Inbox folder and the other is in Sent Items folder, this requirement can be captured.
            bool allFoldersSearched = (searchResponse.Results[0].CollectionId == User1Information.InboxCollectionId && searchResponse.Results[1].CollectionId == User1Information.SentItemsCollectionId) || (searchResponse.Results[1].CollectionId == User1Information.InboxCollectionId && searchResponse.Results[0].CollectionId == User1Information.SentItemsCollectionId);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R176");
            Site.Log.Add(LogEntryKind.Debug, "The emails found are in folders with CollectionId {0} and {1}.", searchResponse.Results[0].CollectionId, searchResponse.Results[1].CollectionId);

            // Verify MS-ASCON requirement: MS-ASCON_R176
            Site.CaptureRequirementIfIsTrue(
                allFoldersSearched,
                176,
                @"[In Finding a Conversation] Searching for a particular conversation will search across all folders for all e-mail messages that are in the conversation.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R220");
            Site.Log.Add(LogEntryKind.Debug, "The emails found are in folders with CollectionId {0} and {1}.", searchResponse.Results[0].CollectionId, searchResponse.Results[1].CollectionId);

            // Verify MS-ASCON requirement: MS-ASCON_R220
            Site.CaptureRequirementIfIsTrue(
                allFoldersSearched,
                220,
                @"[In Processing a Search Command] When the server receives a request to find a conversation, as specified in section 3.1.4.7, the server searches across all folders for all e-mail messages that are in the conversation and returns this set of e-mail messages.");
            #endregion
        }
Exemplo n.º 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
        }
Exemplo n.º 7
0
        public void MSASCON_S01_TC06_Sync_NoConversationId()
        {
            #region Initialize sync and get synckey.
            SyncRequest syncRequest = Common.CreateInitialSyncRequest(User1Information.CalendarCollectionId);
            SyncStore   syncStore   = this.CONAdapter.Sync(syncRequest);
            #endregion

            #region Create a calendar item and sync to get the ConversationId node in the response xml.
            string calendarSubject = Common.GenerateResourceName(Site, "TestCalendar");
            this.SyncAdd(User1Information.CalendarCollectionId, calendarSubject, syncStore.SyncKey);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.CalendarCollectionId, calendarSubject, false);

            // Call initial Sync command.
            syncRequest = Common.CreateInitialSyncRequest(User1Information.CalendarCollectionId);
            syncStore   = this.CONAdapter.Sync(syncRequest);

            // Sync calendar folder
            syncRequest = TestSuiteHelper.GetSyncRequest(User1Information.CalendarCollectionId, syncStore.SyncKey, null, null, false);
            this.CONAdapter.Sync(syncRequest);
            System.Xml.XmlDocument xmlDoc          = new System.Xml.XmlDocument();
            XmlElement             lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            xmlDoc.LoadXml(lastRawResponse.InnerXml);
            System.Xml.XmlNodeList conversationIdNodes = xmlDoc.GetElementsByTagName("ConversationId");

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

            // Verify MS-ASCON requirement: MS-ASCON_R77
            // If the ConversionId node does not exist, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual(
                0,
                conversationIdNodes.Count,
                77,
                @"[In ConversationId (Sync)] The email2:ConversationId element is not present if there is no conversation ID associated with the message.");
            #endregion
        }
Exemplo n.º 8
0
        public void MSASCON_S03_TC08_ItemOperations_MessagePart()
        {
            this.CheckActiveSyncVersionIsNot140();

            #region User2 sends an email to User1
            this.SwitchUser(this.User2Information, true);

            string subject             = Common.GenerateResourceName(Site, "Subject");
            string body                = Common.GenerateResourceName(Site, "Body");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, subject, body);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, subject, false);
            #endregion

            #region Call ItemOperations command without BodyPreference or BodyPartPreference element.
            this.SwitchUser(this.User1Information, false);

            // Get all of the email BodyPart data.
            BodyPartPreference bodyPartPreference = new BodyPartPreference()
            {
                Type = 2,
            };

            DataStructures.Sync syncItem        = this.SyncEmail(subject, User1Information.InboxCollectionId, true, bodyPartPreference, null);
            XmlElement          lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string allData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);

            DataStructures.Email email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, null);
            this.VerifyMessagePartWithoutPreference(email);

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

            // Verify MS-ASCON requirement: MS-ASCON_R340
            Site.CaptureRequirementIfIsNull(
                email.BodyPart,
                340,
                @"[In Sending a Message Part] The airsyncbase:BodyPart element is not present in the [ItemOperations command] response if the client did not request the message part, as specified in section 3.1.4.10.");
            #endregion

            #region Call ItemOperations command with only BodyPreference element.
            BodyPreference bodyPreference = new BodyPreference()
            {
                Type = 2,
            };

            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, null, bodyPreference);
            this.VerifyMessagePartWithBodyPreference(email);
            #endregion

            #region Call ItemOperations command with only BodyPartPreference element.
            bodyPartPreference = new BodyPartPreference()
            {
                Type                    = 2,
                TruncationSize          = 12,
                TruncationSizeSpecified = true,
            };

            email           = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, null);
            lastRawResponse = (XmlElement)this.CONAdapter.LastRawResponseXml;
            string truncatedData = TestSuiteHelper.GetDataInnerText(lastRawResponse, "BodyPart", "Data", subject);
            this.VerifyMessagePartWithBodyPartPreference(email, truncatedData, allData, (int)bodyPartPreference.TruncationSize);

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

            // Verify MS-ASCON requirement: MS-ASCON_R236
            Site.CaptureRequirementIfIsNotNull(
                email.BodyPart,
                236,
                @"[In Sending a Message Part] If the client [Sync command request ([MS-ASCMD] section 2.2.1.21), Search command request ([MS-ASCMD] section 2.2.1.16) or] ItemOperations command request 9([MS-ASCMD] section 2.2.1.10) includes the airsyncbase:BodyPartPreference element (section 2.2.2.2), then the server uses the airsyncbase:BodyPart element (section 2.2.2.1) to encapsulate the message part in the response.");

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

            // A message part and its meta-data are encapsulated by BodyPart element in the ItemOperation response, so this requirement can be captured.
            Site.CaptureRequirement(
                39,
                @"[In BodyPart] The airsyncbase:BodyPart element ([MS-ASAIRS] section 2.2.2.10) encapsulates a message part and its meta-data in [a Sync command response ([MS-ASCMD] section 2.2.1.21),] an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) [or a Search command response ([MS-ASCMD] section 2.2.1.16)].");
            #endregion

            #region Call ItemOperations command with both BodyPreference and BodyPartPreference elements.
            email = this.ItemOperationsFetch(User1Information.InboxCollectionId, syncItem.ServerId, bodyPartPreference, bodyPreference);
            this.VerifyMessagePartWithBothPreference(email);
            #endregion
        }
Exemplo n.º 9
0
        public void MSASCON_S03_TC02_ItemOperations_MoveAlways()
        {
            #region Create a conversation and get the created conversation item
            string           conversationSubject    = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem sourceConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Move one email in the conversation to Sent Items folder
            Collection <string> idToMove = new Collection <string>();
            idToMove.Add(sourceConversationItem.ServerId[0]);
            this.CallMoveItemsCommand(idToMove, User1Information.InboxCollectionId, User1Information.SentItemsCollectionId);
            #endregion

            #region Call ItemOperations command to move the conversation from Inbox to DeletedItems folder
            ItemOperationsResponse itemOperationResponse = this.ItemOperationsMove(sourceConversationItem.ConversationId, User1Information.DeletedItemsCollectionId, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.SentItemsCollectionId, conversationSubject, false);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.DeletedItemsCollectionId, conversationSubject, false);

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

            // Verify MS-ASCON requirement: MS-ASCON_R143
            Site.CaptureRequirementIfAreEqual(
                "1",
                itemOperationResponse.ResponseData.Response.Move[0].Status,
                143,
                @"[In Status] [The meaning of status value] 1 [is] Success. The server successfully completed the operation.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R216
            // If R143 has been captured and the ConversationId element is not null, then this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                itemOperationResponse.ResponseData.Response.Move[0].ConversationId,
                216,
                @"[In Always Moving a Conversation] The server sends an ItemOperations command response ([MS-ASCMD] section 2.2.1.10) that includes the itemoperations:Status element, as specified in section 2.2.2.10, and the itemoperations:ConversationId element (section 2.2.2.3.1).");
            #endregion

            #region User1 syncs messages in the Inbox folder and Deleted Items folder after conversation moved
            DataStructures.Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "No conversation messages should not be found in Inbox folder.");

            ConversationItem destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count - 1, destinationCoversationItem.ServerId.Count, "All conversation messages except in Sent Items Folder should be moved to Deleted Items folder.");
            #endregion

            #region User2 replies the received message to create a future e-mail message for that conversation.
            this.SwitchUser(this.User2Information, false);
            syncResult = this.SyncEmail(conversationSubject, User2Information.InboxCollectionId, true, null, null);

            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            // Smart reply the received email from User2 to User1.
            this.CallSmartReplyCommand(syncResult.ServerId, User2Information.InboxCollectionId, user2MailboxAddress, user1MailboxAddress, conversationSubject);

            // Switch the current user to User1.
            this.SwitchUser(this.User1Information, false);

            destinationCoversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, sourceConversationItem.ConversationId, sourceConversationItem.ServerId.Count + 1);
            Site.Assert.AreEqual(sourceConversationItem.ServerId.Count, destinationCoversationItem.ServerId.Count, "The future message should be moved to Deleted Items folder.");

            // Check if the received email is in Inbox folder.
            syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);
            Site.Assert.IsNull(syncResult, "The future message should not be found in Inbox folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                68,
                @"[In ConversationId (ItemOperations)] In an ItemOperations command request ([MS-ASCMD] section 2.2.1.10), the itemoperations:ConversationId element ([MS-ASCMD] section 2.2.3.35.1) is a required child element of the itemoperations:Move element ([MS-ASCMD] section 2.2.3.117.1) that specifies the conversation ID of the conversation that is to be moved.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                118,
                @"[In DstFldId] The itemoperations:DstFldId element ([MS-ASCMD] section 2.2.3.51.1) is a required child element of the itemoperations:Move element ([MS-ASCMD] section 2.2.3.117.1) in an ItemOperations command request ([MS-ASCMD] section 2.2.1.10) that specifies the folder to which the conversation is moved.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                130,
                @"[In MoveAlways] When a conversation is set to always be moved, all e-mail messages in the conversation, including all future e-mail messages in the conversation, are moved from all folders except the Sent Items folder to the destination folder that is specified by the DstFldId element (section 2.2.2.6).");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                166,
                @"[In Ignoring a Conversation] When a conversation is ignored, all e-mail messages in the conversation, including all future e-mail messages for that conversation, are moved from all folders except Sent Items folder to the Deleted Items folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                172,
                @"[In Setting up a Conversation to Be Moved Always] When a conversation is set to be moved always, all e-mail messages in the conversation, including all future e-mail messages for that conversation, are moved from all folders except Sent Items folder to a destination folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                213,
                @"[In Ignoring a Conversation] When the server receives a request to ignore a conversation, as specified in section 3.1.4.4, the server moves all e-mail messages in the conversation, including all future e-mail messages for that conversation, from all folders except Sent Items folder to the Deleted Items folder.");

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

            // If all messages except the one in Sent Items Folder and future message are moved to DeletedItems folder, then this requirement can be captured.
            Site.CaptureRequirement(
                215,
                @"[In Always Moving a Conversation] When the server receives a request to always move a conversation, as specified in section 3.1.4.6, the server moves all e-mail messages in the conversation, including all future e-mail messages for that conversation, from all folders except Sent Items folder to the specified destination folder.");
            #endregion
        }
Exemplo n.º 10
0
        public void MSASCON_S01_TC05_Sync_ConversationIndex()
        {
            #region User2 sends mail to User1
            this.SwitchUser(this.User2Information, true);
            string conversationSubject = Common.GenerateResourceName(Site, "Conversation");
            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);
            this.CallSendMailCommand(user2MailboxAddress, user1MailboxAddress, conversationSubject, null);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, false);
            #endregion

            #region User1 replies to User2
            this.SwitchUser(this.User1Information, false);
            Sync syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, true, null, null);

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

            // Verify MS-ASCON requirement: MS-ASCON_R304
            // If the ConversationIndex element is not null, then this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                syncResult.Email.ConversationIndex,
                304,
                @"[In ConversationIndex] The value of the first timestamp is derived from the date and time when the message was originally sent by the server.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R95
            // If the ConversationIndex element is not null, then this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                syncResult.Email.ConversationIndex,
                95,
                @"[In Conversation Index Header] The Conversation Index Header value is derived from the date and time when the message was originally sent by the server.");

            byte[] conversationIndexHeader = Convert.FromBase64String(syncResult.Email.ConversationIndex);

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

            // Verify MS-ASCON requirement: MS-ASCON_R90
            // If the ConversationIndex element is 5 bytes in length, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                5,
                conversationIndexHeader.Length,
                90,
                @"[In ConversationIndex] Conversation Index Header (5 bytes): A Conversation Index Header that is derived from the date and time when the message was originally sent by the server, as specified in section 2.2.2.4.1.");

            bool conversationIdAndIndex = syncResult.Email.ConversationIndex != null && syncResult.Email.ConversationId != null;

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

            // Verify MS-ASCON requirement: MS-ASCON_R192
            // If the ConversationIndex element and ConversationId element both exist, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                conversationIdAndIndex,
                192,
                @"[In Abstract Data Model] The server creates a conversation ID and a conversation index on the e-mail item when the user sends an e-mail message.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R194
            // If the ConversationIndex element and ConversationId element both exist, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                conversationIdAndIndex,
                194,
                @"[In Higher-Layer Triggered Events] The server creates a conversation ID and a conversation index on the e-mail item when the user sends an e-mail message.");

            this.CallSmartReplyCommand(syncResult.ServerId, User1Information.InboxCollectionId, user1MailboxAddress, user2MailboxAddress, conversationSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, User2Information.InboxCollectionId, conversationSubject, false);
            #endregion

            #region User2 forwards to User3
            this.SwitchUser(this.User2Information, false);
            syncResult = this.SyncEmail(conversationSubject, User2Information.InboxCollectionId, true, null, null);
            byte[] conversationIndexReply = Convert.FromBase64String(syncResult.Email.ConversationIndex);

            bool additionalTimestampAdded = conversationIndexReply.Length > conversationIndexHeader.Length && BitConverter.ToString(conversationIndexReply).Replace("-", string.Empty).StartsWith(BitConverter.ToString(conversationIndexHeader).Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R86");
            Site.Log.Add(LogEntryKind.Debug, "After User1 reply the email to User2, the ConversationIndex is {0} and its length is {1}.", conversationIndexReply, conversationIndexReply.Length);

            // Verify MS-ASCON requirement: MS-ASCON_R86
            // If the ConversationIndex element is longer than ConversationIndexHeader which means additional timestamp has been added to ConversationIndex, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                additionalTimestampAdded,
                86,
                @"[In ConversationIndex] Each additional timestamp specifies the difference between the current time and the time specified by the first timestamp.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R87");
            Site.Log.Add(LogEntryKind.Debug, "After User1 reply the email to User2, the ConversationIndex is {0} and its length is {1}.", conversationIndexReply, conversationIndexReply.Length);

            // Verify MS-ASCON requirement: MS-ASCON_R87
            // If the ConversationIndex element is longer than ConversationIndexHeader which means additional timestamp has been added to ConversationIndex, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                additionalTimestampAdded,
                87,
                @"[In ConversationIndex] Additional timestamps are added when the message is  [forwarded or] replied to.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R91
            // If the ConversationIndex element is 5 bytes longer than ConversationIndexHeader, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexHeader.Length + 5,
                conversationIndexReply.Length,
                91,
                @"[In ConversationIndex] Response Level 1 (5 bytes): A Response Level that contains information about the time the message was [forwarded or] replied to.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R306
            // If the ConversationIndex element is 5 bytes longer than ConversationIndexHeader, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexHeader.Length + 5,
                conversationIndexReply.Length,
                306,
                @"[In ConversationIndex] [Response Level 1 (5 bytes):] Additional Response Level fields are added to the email2:ConversationIndex each time the message is [forwarded or] replied to.");

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

            // Verify MS-ASCON requirement: MS-ASCON_R307
            // If the ConversationIndex element is 5 bytes longer than ConversationIndexHeader, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexHeader.Length + 5,
                conversationIndexReply.Length,
                307,
                @"[In ConversationIndex] Response Level N (5 bytes): Additional Response Level fields for each time the message is [forwarded or] replied to. ");

            string user3MailboxAddress = Common.GetMailAddress(User3Information.UserName, User3Information.UserDomain);

            this.CallSmartForwardCommand(syncResult.ServerId, User2Information.InboxCollectionId, user2MailboxAddress, user3MailboxAddress, conversationSubject);
            #endregion

            #region User3 gets the email.
            this.SwitchUser(this.User3Information, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User3Information, User3Information.InboxCollectionId, conversationSubject, false);

            syncResult = this.SyncEmail(conversationSubject, User3Information.InboxCollectionId, true, null, null);
            byte[] conversationIndexForward = Convert.FromBase64String(syncResult.Email.ConversationIndex);

            additionalTimestampAdded = conversationIndexForward.Length > conversationIndexReply.Length && BitConverter.ToString(conversationIndexForward).Replace("-", string.Empty).StartsWith(BitConverter.ToString(conversationIndexReply).Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R88");
            Site.Log.Add(LogEntryKind.Debug, "After User2 forward the email to User3, the ConversationIndex is {0} and its length is {1}.", conversationIndexForward, conversationIndexForward.Length);

            // Verify MS-ASCON requirement: MS-ASCON_R88
            // If the ConversationIndex element is longer than the ConversationIndex of the most recent email which means additional timestamp has been added to ConversationIndex, then this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                additionalTimestampAdded,
                88,
                @"[In ConversationIndex] Additional timestamps are added when the message is forwarded [or replied to].");

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

            // Verify MS-ASCON requirement: MS-ASCON_R259
            // If the ConversationIndex element is 5 bytes longer than the ConversationIndex of the most recent email, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexReply.Length + 5,
                conversationIndexForward.Length,
                259,
                @"[In ConversationIndex] Response Level 1 (5 bytes): A Response Level that contains information about the time the message was forwarded [or replied to].");

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

            // Verify MS-ASCON requirement: MS-ASCON_R305
            // If the ConversationIndex element is 5 bytes longer than the ConversationIndex of the most recent email, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexReply.Length + 5,
                conversationIndexForward.Length,
                305,
                @"[In ConversationIndex] [Response Level 1 (5 bytes):] Additional Response Level fields are added to the email2:ConversationIndex each time the message is forwarded [or replied to].");

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

            // Verify MS-ASCON requirement: MS-ASCON_R92
            // If the ConversationIndex element is 5 bytes longer than the ConversationIndex of the most recent email, then this requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                conversationIndexReply.Length + 5,
                conversationIndexForward.Length,
                92,
                @"[In ConversationIndex] Response Level N (5 bytes): Additional Response Level fields for each time the message is forwarded [or replied to].");
            #endregion
        }
Exemplo n.º 11
0
        public void MSASCON_S01_TC03_Sync_Delete()
        {
            #region Create a conversation and sync to get the created conversation item.
            string           conversationSubject   = Common.GenerateResourceName(Site, "Conversation");
            ConversationItem inboxConversationItem = this.CreateConversation(conversationSubject);
            #endregion

            #region Delete the created conversation by Sync command.
            string[] serverIds = new string[inboxConversationItem.ServerId.Count];
            inboxConversationItem.ServerId.CopyTo(serverIds, 0);
            SyncStore syncStore = this.SyncDelete(User1Information.InboxCollectionId, this.LatestSyncKey, serverIds);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, true);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.DeletedItemsCollectionId, conversationSubject, false);

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

            // Verify MS-ASCON requirement: MS-ASCON_R201
            // If the response is not null, this requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                syncStore,
                201,
                @"[In Deleting a Conversation] The server sends a Sync command response as specified in [MS-ASCMD] section 2.2.1.21.");
            #endregion

            #region Sync messages in the Inbox and Deleted Items folder after conversation deleted.
            Sync deleteResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, false, null, null);

            ConversationItem deleteConversationItem = this.GetConversationItem(User1Information.DeletedItemsCollectionId, inboxConversationItem.ConversationId);

            // Verify that server moves all e-mail messages that are in the conversation from the Inbox folder to the Deleted Items folder
            bool isDeleted = deleteConversationItem.ServerId.Count == inboxConversationItem.ServerId.Count && deleteResult == null;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R199");
            Site.Log.Add(LogEntryKind.Debug, "The count of emails in the specified conversation moved to Deleted Items folder is {0}.", deleteConversationItem.ServerId.Count);
            Site.Log.Add(LogEntryKind.Debug, "The count of emails in the specified conversation deleted from Inbox folder is {0}.", inboxConversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R199
            // If all emails in the conversation are deleted, then this requirement is captured.
            Site.CaptureRequirementIfIsTrue(
                isDeleted,
                199,
                @"[In Deleting a Conversation] When the server receives a request to delete a conversation, as specified in section 3.1.4.1, the server moves all e-mail messages that are in the conversation from the current folder to the Deleted Items folder.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R157");
            Site.Log.Add(LogEntryKind.Debug, "The count of emails in the specified conversation moved to Deleted Items folder is {0}.", deleteConversationItem.ServerId.Count);
            Site.Log.Add(LogEntryKind.Debug, "The count of emails in the specified conversation deleted from Inbox folder is {0}.", inboxConversationItem.ServerId.Count);

            // Verify MS-ASCON requirement: MS-ASCON_R157
            // If all emails in the conversation are deleted, then this requirement is captured.
            Site.CaptureRequirementIfIsTrue(
                isDeleted,
                157,
                @"[In Deleting a Conversation] When a conversation is deleted, all e-mail messages that are in the conversation are moved from the current folder to the Deleted Items folder.");
            #endregion

            #region User2 replies a message to create a future e-mail message for that conversation.
            // Switch the current user to User2.
            this.SwitchUser(this.User2Information, false);
            Sync syncResult = this.SyncEmail(conversationSubject, User2Information.InboxCollectionId, true, null, null);

            string user1MailboxAddress = Common.GetMailAddress(User1Information.UserName, User1Information.UserDomain);
            string user2MailboxAddress = Common.GetMailAddress(User2Information.UserName, User2Information.UserDomain);

            // Smart reply the received email from User2 to User1.
            this.CallSmartReplyCommand(syncResult.ServerId, User2Information.InboxCollectionId, user2MailboxAddress, user1MailboxAddress, conversationSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, User1Information.InboxCollectionId, conversationSubject, false);

            // Switch the current user to User1.
            this.SwitchUser(this.User1Information, false);
            syncResult = this.SyncEmail(conversationSubject, User1Information.InboxCollectionId, true, null, null);
            ConversationItem futureInboxConversation = this.GetConversationItem(User1Information.InboxCollectionId, syncResult.Email.ConversationId);

            bool isFutureEmailMoved = futureInboxConversation.ServerId.Count == 1 && futureInboxConversation.ConversationId == inboxConversationItem.ConversationId;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R158");
            Site.Log.Add(LogEntryKind.Debug, "The count of the received emails of the specified conversation in Inbox folder is {0}.", futureInboxConversation.ServerId.Count);
            Site.Log.Add(LogEntryKind.Debug, "The ConversationId of the received email in Inbox folder should be {0}, while it is {1} for the deleted emails.", futureInboxConversation.ConversationId, inboxConversationItem.ConversationId);

            // Verify MS-ASCON requirement: MS-ASCON_R158
            // New email of the conversation is received and it is not moved to Deleted Items folder, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isFutureEmailMoved,
                158,
                @"[In Deleting a Conversation] Future e-mail messages for the same conversation are not affected.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R200");
            Site.Log.Add(LogEntryKind.Debug, "The count of the received emails of the specified conversation in Inbox folder is {0}.", futureInboxConversation.ServerId.Count);
            Site.Log.Add(LogEntryKind.Debug, "The ConversationId of the received email in Inbox folder should be {0}, while it is {1} for the deleted emails.", futureInboxConversation.ConversationId, inboxConversationItem.ConversationId);

            // Verify MS-ASCON requirement: MS-ASCON_R200
            // New email of the conversation is received and it is not moved to Deleted Items folder, so this requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isFutureEmailMoved,
                200,
                @"[In Deleting a Conversation] The server does not move future e-mail messages for the conversation.");
            #endregion
        }