/// <summary> /// Search item with specified criteria on the server. /// </summary> /// <param name="subject">The subject of the item.</param> /// <param name="collectionId">The collection id.</param> /// <param name="conversationId">The conversation for which to search.</param> /// <param name="bodyPreferences">The bodyPreference in the options element.</param> /// <param name="bodyPartPreferences">The bodyPartPreference in the options element.</param> /// <returns>The server response.</returns> protected DataStructures.Search GetSearchResult(string subject, string collectionId, string conversationId, Request.BodyPreference[] bodyPreferences, Request.BodyPartPreference[] bodyPartPreferences) { SearchRequest request = TestSuiteHelper.CreateSearchRequest(subject, collectionId, conversationId, bodyPreferences, bodyPartPreferences); DataStructures.SearchStore searchStore = this.ASAIRSAdapter.Search(request); DataStructures.Search searchItem = null; if (searchStore.Results.Count != 0) { searchItem = TestSuiteHelper.GetSearchItem(searchStore, subject); } this.Site.Assert.IsNotNull(searchItem, "The email message with subject {0} should be found.", subject); return(searchItem); }
/// <summary> /// Get the email item from the Search response by using the subject as the search criteria. /// </summary> /// <param name="searchStore">The Search command result.</param> /// <param name="fileAs">The FileAs of the contact.</param> /// <returns>The email item corresponds to the specified subject.</returns> internal static DataStructures.Search GetSearchItem(DataStructures.SearchStore searchStore, string fileAs) { DataStructures.Search searchItem = null; if (searchStore.Results.Count > 0) { foreach (DataStructures.Search item in searchStore.Results) { if (item.Contact.FileAs == fileAs) { searchItem = item; break; } } } return(searchItem); }
public void MSASAIRS_S03_TC02_NormalAttachment() { #region Send a mail with normal attachment string subject = Common.GenerateResourceName(Site, "Subject"); string body = Common.GenerateResourceName(Site, "Body"); this.SendEmail(EmailType.NormalAttachment, subject, body); #endregion #region Verify requirements DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null); this.VerifyMethodElementValue(syncItem.Email, 1); DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null); this.VerifyMethodElementValue(itemOperationsItem.Email, 1); if (Common.IsRequirementEnabled(53, this.Site)) { DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, null, null, null); this.VerifyMethodElementValue(searchItem.Email, 1); } // According to above steps, requirement MS-ASAIRS_R225 can be captured directly // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R225"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R225 Site.CaptureRequirement( 225, @"[In Method (Attachment)] [The value] 1 [of the Method element] meaning ""Normal attachment"" specifies that the attachment is a normal attachment."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R160"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R160 Site.CaptureRequirementIfIsNotNull( ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).ContentId, 160, @"[In ContentId (Attachment)] The ContentId element is an optional child element of the Attachment element (section 2.2.2.7) that contains the unique object ID for an attachment."); this.Site.CaptureRequirementIfIsNotNull( ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).ContentId, 1343, @"[In ContentId (Attachment)] [The ContentId element is an optional child element of the Attachment element (section 2.2.2.7) that contains the unique identifier of the attachment, and] is used to reference the attachment within the item to which the attachment belongs."); #endregion }
public void MSASAIRS_S03_TC04_OLEAttachment() { #region Send a mail with an embedded OLE object string subject = Common.GenerateResourceName(Site, "Subject"); string body = Common.GenerateResourceName(Site, "Body"); this.SendEmail(EmailType.AttachOLE, subject, body); #endregion #region Verify requirements DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null); this.VerifyMethodElementValue(syncItem.Email, 6); DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null); this.VerifyMethodElementValue(itemOperationsItem.Email, 6); if (Common.IsRequirementEnabled(53, this.Site)) { DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, itemOperationsItem.Email.ConversationId, null, null); this.VerifyMethodElementValue(searchItem.Email, 6); } // According to above steps, requirement MS-ASAIRS_R230 can be captured directly // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R230"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R230 Site.CaptureRequirement( 230, @"[In Method (Attachment)] [The value] 6 [of the Method element] meaning ""Attach OLE"" indicates that the attachment is an embedded Object Linking and Embedding (OLE) object, such as an inline image."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R100299"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R100299 Site.CaptureRequirementIfIsTrue( ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).IsInline, 100299, @"[In IsInline (Attachment)] If the value[IsInline] is TRUE, then the attachment is embedded in the message."); #endregion }
public void MSASAIRS_S03_TC03_EmbeddedMessageAttachment() { #region Send a mail with an e-mail messsage attachment string subject = Common.GenerateResourceName(Site, "Subject"); string body = Common.GenerateResourceName(Site, "Body"); this.SendEmail(EmailType.EmbeddedAttachment, subject, body); #endregion #region Verify requirements DataStructures.Sync syncItem = this.GetSyncResult(subject, this.User2Information.InboxCollectionId, null, null, null); this.VerifyMethodElementValue(syncItem.Email, 5); DataStructures.ItemOperations itemOperationsItem = this.GetItemOperationsResult(this.User2Information.InboxCollectionId, syncItem.ServerId, null, null, null, null); this.VerifyMethodElementValue(itemOperationsItem.Email, 5); if (Common.IsRequirementEnabled(53, this.Site)) { DataStructures.Search searchItem = this.GetSearchResult(subject, this.User2Information.InboxCollectionId, itemOperationsItem.Email.ConversationId, null, null); this.VerifyMethodElementValue(searchItem.Email, 5); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R2299"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R2299 Site.CaptureRequirementIfIsTrue( ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).DisplayName.EndsWith(".eml", System.StringComparison.CurrentCultureIgnoreCase), 2299, @"[In Method (Attachment)] [The value] 5 [of the Method element] meaning ""Embedded message"" indicates that the attachment is an e-mail message, and that the attachment file has an .eml extension."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASAIRS_R100298"); // Verify MS-ASAIRS requirement: MS-ASAIRS_R100298 Site.CaptureRequirementIfIsFalse( ((Response.AttachmentsAttachment)syncItem.Email.Attachments.Items[0]).IsInlineSpecified, 100298, @"[In IsInline (Attachment)] If the value[IsInline] is FALSE, then the attachment is not embedded in the message."); #endregion }
/// <summary> /// Get the email item from the Search response by using the subject as the search criteria. /// </summary> /// <param name="searchStore">The Search command result.</param> /// <param name="subject">The email subject.</param> /// <returns>The email item corresponds to the specified subject.</returns> internal static DataStructures.Search GetSearchItem(DataStructures.SearchStore searchStore, string subject) { DataStructures.Search searchItem = null; if (searchStore.Results.Count > 0) { foreach (DataStructures.Search item in searchStore.Results) { if (item.Email.Subject == subject) { searchItem = item; break; } if (item.Calendar.Subject == subject) { searchItem = item; break; } } } return(searchItem); }
/// <summary> /// Load the SearchStore from the SearchResponse /// </summary> /// <param name="search">The returned Search response.</param> /// <returns>A SearchStore instance</returns> public static DataStructures.SearchStore LoadSearchResponse(SearchResponse search) { DataStructures.SearchStore searchStore = new DataStructures.SearchStore(); if (search.ResponseData.Status != null) { searchStore.Status = search.ResponseData.Status; if (!searchStore.Status.Equals("1")) { return searchStore; } } searchStore.StoreStatus = search.ResponseData.Response.Store.Status; if (!searchStore.StoreStatus.Equals("1")) { return searchStore; } searchStore.Range = search.ResponseData.Response.Store.Range; if (!string.IsNullOrEmpty(search.ResponseData.Response.Store.Total)) { searchStore.Total = Convert.ToInt32(search.ResponseData.Response.Store.Total, CultureInfo.InvariantCulture); } if (search.ResponseData.Response.Store.Result == null) { return searchStore; } if (search.ResponseData.Response.Store.Result.Length == 1 && search.ResponseData.Response.Store.Result[0].CollectionId == null) { return searchStore; } foreach (Response.SearchResponseStoreResult result in search.ResponseData.Response.Store.Result) { DataStructures.Search searchResult = new DataStructures.Search { LongId = result.LongId, Class = result.Class, CollectionId = result.CollectionId, Note = DataStructures.Note.DeserializeFromSearchProperties<DataStructures.Note>(result.Properties), Calendar = DataStructures.Calendar.DeserializeFromSearchProperties<DataStructures.Calendar>(result.Properties), Contact = DataStructures.Contact.DeserializeFromSearchProperties<DataStructures.Contact>(result.Properties), Email = DataStructures.Email.DeserializeFromSearchProperties<DataStructures.Email>(result.Properties), Task = DataStructures.Task.DeserializeFromSearchProperties<DataStructures.Task>(result.Properties) }; searchStore.Results.Add(searchResult); } return searchStore; }