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 }
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 }
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 } }
/// <summary> /// Call Search command to find a specified conversation. /// </summary> /// <param name="conversationId">The ConversationId of the items to search.</param> /// <param name="itemsCount">The count of the items expected to be found.</param> /// <param name="bodyPartPreference">The BodyPartPreference element.</param> /// <param name="bodyPreference">The BodyPreference element.</param> /// <returns>The SearchStore instance that contains the search result.</returns> protected SearchStore CallSearchCommand(string conversationId, int itemsCount, Request.BodyPartPreference bodyPartPreference, Request.BodyPreference bodyPreference) { // Create Search command request. SearchRequest searchRequest = TestSuiteHelper.GetSearchRequest(conversationId, bodyPartPreference, bodyPreference); SearchStore searchStore = this.CONAdapter.Search(searchRequest, true, itemsCount); Site.Assert.AreEqual("1", searchStore.Status, "The Search operation should be success."); return(searchStore); }
/// <summary> /// Find the specified email. /// </summary> /// <param name="subject">The subject of the email to find.</param> /// <param name="collectionId">The folder collectionId which needs to be synchronized.</param> /// <param name="isRetryNeeded">A Boolean value indicates whether need retry.</param> /// <param name="bodyPartPreference">The bodyPartPreference in the options element.</param> /// <param name="bodyPreference">The bodyPreference in the options element.</param> /// <returns>The found email object.</returns> protected Sync SyncEmail(string subject, string collectionId, bool isRetryNeeded, Request.BodyPartPreference bodyPartPreference, Request.BodyPreference bodyPreference) { // Call initial Sync command. SyncRequest syncRequest = Common.CreateInitialSyncRequest(collectionId); SyncStore syncStore = this.CONAdapter.Sync(syncRequest); // Find the specific email. syncRequest = TestSuiteHelper.GetSyncRequest(collectionId, syncStore.SyncKey, bodyPartPreference, bodyPreference, false); Sync syncResult = this.CONAdapter.SyncEmail(syncRequest, subject, isRetryNeeded); this.LatestSyncKey = syncStore.SyncKey; return(syncResult); }
/// <summary> /// Call ItemOperations command to fetch an email in the specific folder. /// </summary> /// <param name="collectionId">The folder collection id to be fetched.</param> /// <param name="serverId">The ServerId of the item</param> /// <param name="bodyPartPreference">The BodyPartPreference element.</param> /// <param name="bodyPreference">The bodyPreference element.</param> /// <returns>An Email instance that includes the fetch result.</returns> protected Email ItemOperationsFetch(string collectionId, string serverId, Request.BodyPartPreference bodyPartPreference, Request.BodyPreference bodyPreference) { ItemOperationsRequest itemOperationsRequest = TestSuiteHelper.GetItemOperationsRequest(collectionId, serverId, bodyPartPreference, bodyPreference); ItemOperationsResponse itemOperationsResponse = this.CONAdapter.ItemOperations(itemOperationsRequest); Site.Assert.AreEqual("1", itemOperationsResponse.ResponseData.Status, "The ItemOperations operation should be success."); ItemOperationsStore itemOperationsStore = Common.LoadItemOperationsResponse(itemOperationsResponse); Site.Assert.AreEqual(1, itemOperationsStore.Items.Count, "Only one email is supposed to be fetched."); Site.Assert.AreEqual("1", itemOperationsStore.Items[0].Status, "The fetch result should be success."); Site.Assert.IsNotNull(itemOperationsStore.Items[0].Email, "The fetched email should not be null."); return(itemOperationsStore.Items[0].Email); }
/// <summary> /// Sync items in the specified folder. /// </summary> /// <param name="collectionId">The CollectionId of the folder.</param> /// <param name="conversationMode">The value of ConversationMode element.</param> /// <returns>A SyncStore instance that contains the result.</returns> protected SyncStore CallSyncCommand(string collectionId, bool conversationMode) { // Call initial Sync command. SyncRequest syncRequest = Common.CreateInitialSyncRequest(collectionId); SyncStore syncStore = this.CONAdapter.Sync(syncRequest); // Verify Sync command response. Site.Assert.AreEqual <byte>( 1, syncStore.CollectionStatus, "If the Sync command executes successfully, the Status in response should be 1."); if (conversationMode && Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site) != "12.1") { syncRequest = TestSuiteHelper.GetSyncRequest(collectionId, syncStore.SyncKey, null, null, true); } else { syncRequest = TestSuiteHelper.GetSyncRequest(collectionId, syncStore.SyncKey, null, null, false); } syncStore = this.CONAdapter.Sync(syncRequest); // Verify Sync command response. Site.Assert.AreEqual <byte>( 1, syncStore.CollectionStatus, "If the Sync command executes successfully, the Status in response should be 1."); bool checkSyncStore = syncStore.AddElements != null && syncStore.AddElements.Count != 0; Site.Assert.IsTrue(checkSyncStore, "The items should be gotten from the Sync command response."); this.LatestSyncKey = syncStore.SyncKey; return(syncStore); }
/// <summary> /// Verify the message part when the request contains only BodyPartPreference element. /// </summary> /// <param name="email">The email item server returned.</param> /// <param name="truncatedData">The truncated email data returned in BodyPart.</param> /// <param name="allData">All email data without being truncated.</param> /// <param name="truncationSize">The TruncationSize element specified in BodyPartPreference.</param> protected void VerifyMessagePartWithBodyPartPreference(Email email, string truncatedData, string allData, int truncationSize) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R239"); // Verify MS-ASCON requirement: MS-ASCON_R239 bool isVerifiedR239 = email.BodyPart.TruncatedSpecified && email.BodyPart.Truncated && truncatedData == TestSuiteHelper.TruncateData(allData, truncationSize); Site.CaptureRequirementIfIsTrue( isVerifiedR239, 239, @"[In Sending a Message Part] The client's preferences affect the server response as follows: If the size of the message part exceeds the value specified in the airsyncbase:TruncationSize element ([MS-ASAIRS] section 2.2.2.40.1) of the request, then the server truncates the message part."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R240"); // Verify MS-ASCON requirement: MS-ASCON_R240 bool isVerifiedR240 = email.BodyPart.TruncatedSpecified && email.BodyPart.Truncated && email.BodyPart.EstimatedDataSize > 0; Site.CaptureRequirementIfIsTrue( isVerifiedR240, 240, @"[In Sending a Message Part] The server includes the airsyncbase:Truncated element ([MS-ASAIRS] section 2.2.2.39.1) and the airsyncbase:EstimatedDataSize element ([MS-ASAIRS] section 2.2.2.23.2) in the response when it truncates the message part."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCON_R247"); // Verify MS-ASCON requirement: MS-ASCON_R247 bool isVerifiedR247 = email.Body == null && email.BodyPart != null; Site.CaptureRequirementIfIsTrue( isVerifiedR247, 247, @"[In Sending a Message Part] If request contains only airsyncbase:BodyPartPreference element, then the response contains only airsyncbase:BodyPart element."); }
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 }
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 }