/// <summary> /// Verify the item synchronized from server. /// </summary> /// <param name="item">The item synchronized from server.</param> private void VerifySyncItem(DataStructures.Sync item) { Site.Assert.IsNotNull( item, "The item should not be null."); Site.Assert.IsNotNull( item.Contact.Body, "The Body element should be included in response when the BodyPreference element is specified in request."); }
/// <summary> /// Verify the Type element of an item. /// </summary> /// <param name="email">The email item got from server.</param> /// <param name="typeValue">The value of the Type element.</param> private void VerifyType(DataStructures.Email email, byte typeValue) { Site.Assert.IsNotNull( email.Body, "The Body element should be included in command response when the BodyPreference element is specified in command request."); Site.Assert.AreEqual<byte>( typeValue, email.Body.Type, "The Type value in command response should be {0}.", typeValue); }
/// <summary> /// Verify elements in command response when the request includes multiple BodyPreference elements. /// </summary> /// <param name="email">The email item got from server.</param> /// <param name="body">The body of the email.</param> /// <param name="bodyPreferences">A BodyPreference object.</param> private void VerifyMultipleBodyPreference(DataStructures.Email email, string body, Request.BodyPreference[] bodyPreferences) { Site.Assert.IsNotNull( email.Body, "The Body element should be included in command response when the BodyPreference element is specified in command request."); Site.Assert.IsTrue( email.Body.Truncated, "The data should be truncated since the available data exceeds the TruncationSize value in the second BodyPreference and the first BodyPreference includes the AllOrNone element with a value of 1 (TRUE) along with the TruncationSize element which is smaller than the available data."); Site.Assert.AreEqual<string>( body.Substring(0, (int)bodyPreferences[1].TruncationSize), email.Body.Data, "The data should be truncated to the size that requested by TruncationSize element in the second BodyPreference if the request includes the AllOrNone element with a value of 1 (TRUE) along with the TruncationSize element which is smaller than the available data in the first BodyPreference."); }
/// <summary> /// Verify the Preview element in Body element. /// </summary> /// <param name="email">The email item got from server.</param> /// <param name="allContentEmail">The email item which has full content.</param> /// <param name="bodyPreference">A BodyPreference object.</param> private void VerifyBodyPreview(DataStructures.Email email, DataStructures.Email allContentEmail, Request.BodyPreference[] bodyPreference) { Site.Assert.IsNotNull( email.Body, "The Body element should be included in command response when the BodyPreference element is specified in command request."); Site.Assert.IsNotNull( email.Body.Preview, "The Preview element should be included in command response when the Preview element is specified in command request."); Site.Assert.IsTrue( email.Body.Preview.Length <= bodyPreference[0].Preview, "The Preview element in a response should contain no more than the number of characters specified in the request. The length of Preview element in response is: {0}.", email.Body.Preview.Length); Site.Assert.IsTrue( allContentEmail.Body.Data.Contains(email.Body.Preview), "The Preview element in a response should contain the message part preview returned to the client."); }
/// <summary> /// This method is used to verify whether the Method element is the expected value. /// </summary> /// <param name="email">The email item got from server.</param> /// <param name="methodValue">The expected value of Method element .</param> private void VerifyMethodElementValue(DataStructures.Email email, byte methodValue) { Site.Assert.IsNotNull( email.Attachments, "The Attachments element in response should not be null."); Site.Assert.IsNotNull( email.Attachments.Items, "The Attachment element in response should not be null."); Site.Assert.AreEqual<int>( 1, email.Attachments.Items.Length, "There should be only one Attachment element in response."); Site.Assert.IsNotNull( email.Attachments.Items[0], "The Attachment element in response should not be null."); Site.Assert.AreEqual<byte>( methodValue, ((Response.AttachmentsAttachment)email.Attachments.Items[0]).Method, "The value of Method element in response should be equal to the expected value."); }
/// <summary> /// Verify the Preview element in BodyPart element. /// </summary> /// <param name="email">The email item got from server.</param> /// <param name="allContentEmail">The email item which has full content.</param> /// <param name="bodyPartPreference">A BodyPartPreference object.</param> private void VerifyBodyPartPreview(DataStructures.Email email, DataStructures.Email allContentEmail, Request.BodyPartPreference[] bodyPartPreference) { Site.Assert.IsNotNull( email.BodyPart, "The BodyPart element should be included in command response when the BodyPartPreference element is specified in command request."); Site.Assert.AreEqual<byte>( 1, email.BodyPart.Status, "The Status should be 1 to indicate the success of the command response in returning Data element content given the BodyPartPreference element settings in the command request."); Site.Assert.IsNotNull( email.BodyPart.Preview, "The Preview element should be present in response if a BodyPartPreference element in the request included a Preview element and the server can honor the request."); Site.Assert.IsTrue( email.BodyPart.Preview.Length <= bodyPartPreference[0].Preview, "The Preview element in a response should contain no more than the number of characters specified in the request. The length of Preview element in response is: {0}.", email.BodyPart.Preview.Length); Site.Assert.IsTrue( allContentEmail.BodyPart.Data.Contains(email.BodyPart.Preview), "The Preview element in a response should contain the message part preview returned to the client."); }
/// <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> /// This method is used to verify the Contact class elements that returned from Sync, ItemOperations or Search command response. /// </summary> /// <param name="contactProperties">The contact properties.</param> /// <param name="contact">The contact item returned from server.</param> protected void VerifyContactClassElements(Dictionary<Request.ItemsChoiceType8, object> contactProperties, DataStructures.Contact contact) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R97"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R97 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.AccountName].ToString(), contact.AccountName, 97, @"[In AccountName] The contacts2:AccountName element specifies the account name and/or number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R107"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R107 this.Site.CaptureRequirementIfAreEqual<DateTime?>( DateTime.Parse(contactProperties[Request.ItemsChoiceType8.Anniversary].ToString()), contact.Anniversary, 107, @"[In Anniversary] The Anniversary element specifies the wedding anniversary date for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R112"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R112 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.AssistantName].ToString(), contact.AssistantName, 112, @"[In AssistantName] The AssistantName element specifies the name of the contact's assistant."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R117"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R117 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.AssistantPhoneNumber].ToString(), contact.AssistantPhoneNumber, 117, @"[In AssistantPhoneNumber] The AssistantPhoneNumber element specifies the phone number of the contact's assistant."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R122"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R122 this.Site.CaptureRequirementIfAreEqual<DateTime?>( DateTime.Parse(contactProperties[Request.ItemsChoiceType8.Birthday].ToString()), contact.Birthday, 122, @"[In Birthday] The Birthday element specifies the birth date of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R1120"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R1120 this.Site.CaptureRequirementIfAreEqual<string>( ((Request.Body)contactProperties[Request.ItemsChoiceType8.Body]).Data, contact.Body.Data, 1120, @"[In Body (AirSyncBase Namespace)] The airsyncbase:Body element [is a container ([MS-ASDTYPE] section 2.2) element that] specifies the notes for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R130"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R130 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessAddressCity].ToString(), contact.BusinessAddressCity, 130, @"[In BusinessAddressCity] The BusinessAddressCity element specifies the business city of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R135"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R135 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessAddressCountry].ToString(), contact.BusinessAddressCountry, 135, @"[In BusinessAddressCountry] The BusinessAddressCountry element specifies the business country/region of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R140"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R140 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessAddressPostalCode].ToString(), contact.BusinessAddressPostalCode, 140, @"[In BusinessAddressPostalCode] The BusinessAddressPostalCode element specifies the business postal code for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R143"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R143 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessAddressState].ToString(), contact.BusinessAddressState, 143, @"[In BusinessAddressState] The BusinessAddressState element specifies the business state for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R148"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R148 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessAddressStreet].ToString(), contact.BusinessAddressStreet, 148, @"[In BusinessAddressStreet] The BusinessAddressStreet element specifies the business street address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R153"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R153 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessFaxNumber].ToString(), contact.BusinessFaxNumber, 153, @"[In BusinessFaxNumber] The BusinessFaxNumber element specifies the business fax number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R158"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R158 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.BusinessPhoneNumber].ToString(), contact.BusinessPhoneNumber, 158, @"[In BusinessPhoneNumber] The BusinessPhoneNumber element specifies the primary business phone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R163"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R163 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Business2PhoneNumber].ToString(), contact.Business2PhoneNumber, 163, @"[In Business2PhoneNumber] The Business2PhoneNumber element specifies the secondary business telephone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R168"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R168 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.CarPhoneNumber].ToString(), contact.CarPhoneNumber, 168, @"[In CarPhoneNumber] The CarPhoneNumber element specifies the car telephone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R1030"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R1030 this.Site.CaptureRequirementIfIsNotNull( contact.Categories, 1030, @"[In Categories] The Categories element [is a container ([MS-ASDTYPE] section 2.2) element that] specifies a collection of user labels assigned to the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R10040"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R10040 this.Site.CaptureRequirementIfIsNotNull( contact.Children, 10040, @"[In Children] The Children element [is a container ([MS-ASDTYPE] section 2.2) element that] specifies a collection of the contact's children."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R190"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R190 this.Site.CaptureRequirementIfAreEqual<string>( ((Request.Children)contactProperties[Request.ItemsChoiceType8.Children]).Child[0], contact.Children.Child[0], 190, @"[In Child] The Child element is an optional child element of the Children element that specifies a child of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R195"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R195 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.CompanyMainPhone].ToString(), contact.CompanyMainPhone, 195, @"[In CompanyMainPhone] The contacts2:CompanyMainPhone element specifies the main telephone number for the contact's company."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R200"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R200 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.CompanyName].ToString(), contact.CompanyName, 200, @"[In CompanyName] The CompanyName element specifies the company name for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R205"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R205 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.CustomerId].ToString(), contact.CustomerId, 205, @"[In CustomerId] The contacts2:CustomerId element specifies the customer identifier (ID) for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R209"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R209 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Department].ToString(), contact.Department, 209, @"[In Department] The Department element specifies the department name for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R214"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R214 this.Site.CaptureRequirementIfIsTrue( contact.Email1Address.Contains(contactProperties[Request.ItemsChoiceType8.Email1Address].ToString()), 214, @"[In Email1Address] The Email1Address element specifies the first e-mail address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R221"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R221 this.Site.CaptureRequirementIfIsTrue( contact.Email2Address.Contains(contactProperties[Request.ItemsChoiceType8.Email2Address].ToString()), 221, @"[In Email2Address] The Email2Address element specifies the second e-mail address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R226"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R226 this.Site.CaptureRequirementIfIsTrue( contact.Email3Address.Contains(contactProperties[Request.ItemsChoiceType8.Email3Address].ToString()), 226, @"[In Email3Address] The Email3Address element specifies the third e-mail address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R231"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R231 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.FileAs].ToString(), contact.FileAs, 231, @"[In FileAs] The FileAs element specifies how a contact is filed in the Contacts folder or the recipient information cache folder. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R238"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R238 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.FirstName].ToString(), contact.FirstName, 238, @"[In FirstName] The FirstName element specifies the first name of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R243"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R243 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.GovernmentId].ToString(), contact.GovernmentId, 243, @"[In GovernmentId] The contacts2:GovernmentId element specifies the government-assigned identifier (ID) for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R248"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R248 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeAddressCity].ToString(), contact.HomeAddressCity, 248, @"[In HomeAddressCity] The HomeAddressCity element specifies the home city for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R253"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R253 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeAddressCountry].ToString(), contact.HomeAddressCountry, 253, @"[In HomeAddressCountry] The HomeAddressCountry element specifies the home country/region for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R258"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R258 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeAddressPostalCode].ToString(), contact.HomeAddressPostalCode, 258, @"[In HomeAddressPostalCode] The HomeAddressPostalCode element specifies the home postal code for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R263"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R263 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeAddressState].ToString(), contact.HomeAddressState, 263, @"[In HomeAddressState] The HomeAddressState element specifies the home state for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R268"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R268 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeAddressStreet].ToString(), contact.HomeAddressStreet, 268, @"[In HomeAddressStreet] The HomeAddressStreet element specifies the home street address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R273"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R273 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomeFaxNumber].ToString(), contact.HomeFaxNumber, 273, @"[In HomeFaxNumber] The HomeFaxNumber element specifies the home fax number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R278"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R278 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.HomePhoneNumber].ToString(), contact.HomePhoneNumber, 278, @"[In HomePhoneNumber] The HomePhoneNumber element specifies the home phone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R283"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R283 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Home2PhoneNumber].ToString(), contact.Home2PhoneNumber, 283, @"[In Home2PhoneNumber] The Home2PhoneNumber element specifies the alternative home phone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R288"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R288 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.IMAddress].ToString(), contact.IMAddress, 288, @"[In IMAddress] The contacts2:IMAddress element specifies the instant messaging address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R293"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R293 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.IMAddress2].ToString(), contact.IMAddress2, 293, @"[In IMAddress2] The contacts2:IMAddress2 element specifies the alternative instant messaging address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R298"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R298 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.IMAddress3].ToString(), contact.IMAddress3, 298, @"[In IMAddress3] The contacts2:IMAddress3 element specifies the tertiary instant messaging address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R303"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R303 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.JobTitle].ToString(), contact.JobTitle, 303, @"[In JobTitle] The JobTitle element specifies the contact's job title."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R308"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R308 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.LastName].ToString(), contact.LastName, 308, @"[In LastName] The LastName element specifies the contact's last name."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R313"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R313 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.ManagerName].ToString(), contact.ManagerName, 313, @"[In ManagerName] The contacts2:ManagerName element specifies the distinguished name (DN) (1) of the contact's manager."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R318"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R318 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.MiddleName].ToString(), contact.MiddleName, 318, @"[In MiddleName] The MiddleName element specifies the middle name of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R323"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R323 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.MMS].ToString(), contact.MMS, 323, @"[In MMS] The contacts2:MMS element specifies the Multimedia Messaging Service (MMS) address for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R328"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R328 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.MobilePhoneNumber].ToString(), contact.MobilePhoneNumber, 328, @"[In MobilePhoneNumber] The MobilePhoneNumber element specifies the mobile phone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R333"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R333 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.NickName].ToString(), contact.NickName, 333, @"[In NickName] The contacts2:NickName element specifies the nickname for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R338"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R338 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OfficeLocation].ToString(), contact.OfficeLocation, 338, @"[In OfficeLocation] The OfficeLocation element specifies the office location for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R343"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R343 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OtherAddressCity].ToString(), contact.OtherAddressCity, 343, @"[In OtherAddressCity] The OtherAddressCity element specifies the city for the contact's alternate address."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R348"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R348 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OtherAddressCountry].ToString(), contact.OtherAddressCountry, 348, @"[In OtherAddressCountry] The OtherAddressCountry element specifies the country/region of the contact's alternate address."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R353"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R353 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OtherAddressPostalCode].ToString(), contact.OtherAddressPostalCode, 353, @"[In OtherAddressPostalCode] The OtherAddressPostalCode element specifies the postal code of the contact's alternate address."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R358"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R358 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OtherAddressState].ToString(), contact.OtherAddressState, 358, @"[In OtherAddressState] The OtherAddressState element specifies the state of the contact's alternate address."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R363"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R363 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.OtherAddressStreet].ToString(), contact.OtherAddressStreet, 363, @"[In OtherAddressStreet] The OtherAddressStreet element specifies the street address of the contact's alternate address."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R368"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R368 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.PagerNumber].ToString(), contact.PagerNumber, 368, @"[In PagerNumber] The PagerNumber element specifies the pager number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R373"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R373 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Picture].ToString(), contact.Picture, 373, @"[In Picture] The Picture element specifies the file that contains the picture of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R1021"); // If the contact with picture is successfully added to the server and the picture returned from server is not null, it means the picture satisfies the specified image size. // Verify MS-ASCNTC requirement: MS-ASCNTC_R1021 this.Site.CaptureRequirement( 1021, @"[In Picture] The value of the Picture element MUST be limited to an image size of 36 KB."); try { byte[] pictureByte = Convert.FromBase64String(contact.Picture); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R381"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R381 this.Site.CaptureRequirementIfIsTrue( pictureByte.Length <= 48 * 1024, 381, @"[In Picture] The value of the Picture element MUST be limited to 48 KB of binary content that is encoded with base64 encoding"); } catch (FormatException) { this.Site.Assert.Fail("The Picture element should be encoded with base64 encoding."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R385"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R385 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.RadioPhoneNumber].ToString(), contact.RadioPhoneNumber, 385, @"[In RadioPhoneNumber] The RadioPhoneNumber element specifies the radio phone number for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R390"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R390 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Spouse].ToString(), contact.Spouse, 390, @"[In Spouse] The Spouse element specifies the name of the contact's spouse/partner."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R395"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R395 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Suffix].ToString(), contact.Suffix, 395, @"[In Suffix] The Suffix element specifies the suffix for the contact's name."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R400"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R400 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.Title].ToString(), contact.Title, 400, @"[In Title] The Title element specifies the contact's business title."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R405"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R405 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.WebPage].ToString(), contact.WebPage, 405, @"[In WebPage] The WebPage element specifies the Web site or personal Web page for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R417"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R417 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.YomiCompanyName].ToString(), contact.YomiCompanyName, 417, @"[In YomiCompanyName] The YomiCompanyName element specifies the Japanese phonetic rendering of the company name for the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R422"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R422 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.YomiFirstName].ToString(), contact.YomiFirstName, 422, @"[In YomiFirstName] The YomiFirstName element specifies the Japanese phonetic rendering of the first name of the contact."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R427"); // Verify MS-ASCNTC requirement: MS-ASCNTC_R427 this.Site.CaptureRequirementIfAreEqual<string>( contactProperties[Request.ItemsChoiceType8.YomiLastName].ToString(), contact.YomiLastName, 427, @"[In YomiLastName] The YomiLastName element specifies the Japanese phonetic rendering of the last name of the contact."); }
/// <summary> /// Verify E-Mail Class elements. /// </summary> /// <param name="email">The email message synchronized from server.</param> private void VerifyEmailClassElements(DataStructures.Email email) { this.VerifyBody(email.Body); this.VerifyMeetingRequest(email.MeetingRequest); this.VerifyTo(email.To); this.VerifySender(email.Sender); this.VerifyThreadTopic(email.ThreadTopic); if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { this.VerifyReceivedAsBcc(email.ReceivedAsBcc); this.VerifyLastVerbExecutionTime(email.LastVerbExecutionTime); this.VerifyLastVerbExecuted(email.LastVerbExecuted); this.VerifyConversationId(email.ConversationId); this.VerifyConversationIndex(email.ConversationIndex); this.VerifyCategories(email.Categories); this.VerifyUmCallerID(email.UmCallerID, email.MessageClass); this.VerifyUmUserNotes(email.UmUserNotes, email.MessageClass); if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0")) { this.VerifyBodyPart(email.BodyPart); } } this.VerifyFrom(email.From); this.VerifyEmailSubject(email.Subject); this.VerifyCc(email.CC); this.VerifyReplyTo(email.ReplyTo); this.VerifyDisplayTo(email.DisplayTo); this.VerifyImportance(email.Importance); this.VerifyRead(email.Read); this.VerifyBcc(email.Bcc); this.VerifyIsDraft(email.IsDraft); this.VerifyAttachments(email.Attachments); this.VerifyMessageClass(email.MessageClass); this.VerifyInternetCPID(); this.VerifyFlag(email.Flag); this.VerifyContentClass(email.ContentClass); this.VerifyDateReceived(email.DateReceived); this.VerifyNativeBodyType(email.NativeBodyType); }
/// <summary> /// Get the specified email item from the sync add response by using the subject. /// </summary> /// <param name="syncStore">The sync result.</param> /// <param name="subject">The email subject.</param> /// <returns>Return the specified email item.</returns> internal static DataStructures.Sync GetSyncAddItem(DataStructures.SyncStore syncStore, string subject) { DataStructures.Sync item = null; if (syncStore.AddElements != null) { foreach (DataStructures.Sync syncItem in syncStore.AddElements) { if (syncItem.Email.Subject == subject) { item = syncItem; break; } if (syncItem.Calendar.Subject == subject) { item = syncItem; break; } if (syncItem.Contact.FileAs == subject) { item = syncItem; break; } } } return item; }
/// <summary> /// This method is used to verify the Search Command related requirements. /// </summary> /// <param name="store">A SearchStore object for the Search command request to retrieve e-mail class items from the server that match the criteria specified by the client. </param> private void VerifySearchCommand(DataStructures.SearchStore store) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R57"); // If the response of Search command is not null, then requirements MS-ASEMAIL_R57 and MS-ASEMAIL_R66 can be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R57 Site.CaptureRequirementIfIsNotNull( store, 57, @"[In Searching for E-Mail Data] The server responds with a Search command response ([MS-ASCMD] section 2.2.2.15), as specified in section 3.2.5.2."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R66"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R66 Site.CaptureRequirementIfIsNotNull( store, 66, @"[In Search Command Response] When a client uses the Search command request ([MS-ASCMD] section 2.2.2.15), as specified in section 3.1.5.2, to retrieve E-mail class items from the server that match the criteria specified by the client, the server responds with a Search command response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R67"); // If the schema validation is successful, then MS-ASEMAIL_R67 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R67 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 67, @"[In Search Command Response] Any of the elements that belong to the E-mail class, as specified in section 2.2.2, can be included in a Search command response as child elements of the search:Properties element ([MS-ASCMD] section 2.2.3.132.2)."); foreach (DataStructures.Search item in store.Results) { if (item.Email != null) { if (item.Email.Body != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R247"); Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 247, @"[In Body (Airsyncbase Namespace)] When[airsyncbase:Body] included in a Search command response ([MS-ASCMD] section 2.2.2.15), the airsyncbase:Body element can contain the following child elements: [airsyncbase:Type, airsyncbase:EstimatedDataSize, airsyncbase:Truncated and airsyncbase:Data]"); } this.VerifyEmailClassElements(item.Email); } } this.VerifyMessageSyntax(); this.VerifyAbstractDataModel(); }
/// <summary> /// This method is used to verify the ItemOperations command related requirements. /// </summary> /// <param name="itemOperations">Server response store for the ItemOperations command request to retrieve data from the server for one or more specific e-mail items. </param> private void VerifyItemOperations(DataStructures.ItemOperationsStore itemOperations) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R59"); // If the response is not null, then requirement MS-ASEMAIL_R59 can be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R59 Site.CaptureRequirementIfIsNotNull( itemOperations, 59, @"[In Retrieving Data for One or More E-Mail Items] The server responds with an ItemOperations command response ([MS-ASCMD] section 2.2.2.9), as specified in section 3.2.5.1."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R62"); // If the schema validation is successful, then MS-ASEMAIL_R62 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R62 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 62, @"[In ItemOperations Command Response] Any of the elements that belong to the E-mail class, as specified in section 2.2.2, can be included in an ItemOperations command response."); if (itemOperations.Items != null) { foreach (DataStructures.ItemOperations itemOperationsItem in itemOperations.Items) { if (itemOperationsItem.Email.Body != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R248"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R248 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 248, @"[In Body (Airsyncbase Namespace)] When[airsyncbase:Body] included in an ItemOperations command response ([MS-ASCMD] section 2.2.2.10), the airsyncbase:Body element can contain the following child elements: [airsyncbase:Type, airsyncbase:EstimatedDataSize, airsyncbase:Truncated and airsyncbase:Data]"); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R64"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R64 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 64, @"[In ItemOperations Command Response] E-mail class elements MUST be returned as child elements of the itemoperations:Properties element ([MS-ASCMD] section 2.2.3.132.1) in the ItemOperations command response."); this.VerifyEmailClassElements(itemOperationsItem.Email); } } this.VerifyMessageSyntax(); this.VerifyAbstractDataModel(); }
/// <summary> /// This method is used to verify the Sync Command related requirements. /// </summary> /// <param name="syncStore">Server response store of a Sync command request to synchronize its E-mail class items.</param> private void VerifySyncCommand(DataStructures.SyncStore syncStore) { if (syncStore.AddElements.Count != 0 || syncStore.ChangeElements.Count != 0) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R55"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R55 Site.CaptureRequirementIfAreEqual<byte>( 1, syncStore.CollectionStatus, 55, @"[In Synchronizing E-Mail Data Between Client and Server] The server responds with a Sync command response ([MS-ASCMD] section 2.2.2.20), as specified in section 3.2.5.3."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R70"); // If the server responds with a Sync command response and the status is 1, then MS-ASEMAIL_R70 can be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R70 Site.CaptureRequirementIfAreEqual<byte>( 1, syncStore.CollectionStatus, 70, @"[In Sync Command Response] When a client uses the Sync command request ([MS-ASCMD] section 2.2.2.20), as specified in section 3.1.5.3, to synchronize its E-mail class items for a specified user with the e-mail items that are currently stored by the server, the server responds with a Sync command response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R71"); // If the schema validation is successful, then MS-ASEMAIL_R71 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R71 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 71, @"[In Sync Command Response] Any of the elements that belong to the E-mail class, as specified in section 2.2.2, can be included in a Sync command response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R72"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R72 Site.CaptureRequirement( 72, @"[In Sync Command Response] E-mail class elements MUST be returned as child elements of the airsync:ApplicationData element ([MS-ASCMD] section 2.2.3.11) within either an airsync:Add element ([MS-ASCMD] section 2.2.3.7.2) or an airsync:Change element ([MS-ASCMD] section 2.2.3.24) in the Sync command response."); } this.VerifyMessageSyntax(); this.VerifyAbstractDataModel(); // Verify E-Mail Class elements in Sync command Add response if (syncStore.AddElements.Count != 0) { foreach (DataStructures.Sync item in syncStore.AddElements) { if (item.Email != null) { if (item.Email.Body != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R246"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R246 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 246, @"[In Body (Airsyncbase Namespace)] When[airsyncbase:Body] included in a Sync command response ([MS-ASCMD] section 2.2.2.20), the airsyncbase:Body element can contain the following child elements: [airsyncbase:Type, airsyncbase:EstimatedDataSize, airsyncbase:Truncated and airsyncbase:Data]"); } this.VerifyEmailClassElements(item.Email); } } } // Verify E-Mail Class elements in Sync command Change response if (syncStore.ChangeElements.Count != 0) { foreach (DataStructures.Sync item in syncStore.ChangeElements) { if (item.Email != null) { this.VerifyEmailClassElements(item.Email); } } } }
/// <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; }
/// <summary> /// Get the specified email item from the Sync Change response by using the subject. /// </summary> /// <param name="syncStore">The Sync result.</param> /// <param name="fileAs">The contact FileAs.</param> /// <returns>Return the specified email item.</returns> internal static DataStructures.Sync GetSyncChangeItem(DataStructures.SyncStore syncStore, string fileAs) { DataStructures.Sync item = null; if (syncStore.ChangeElements.Count != 0) { foreach (DataStructures.Sync syncItem in syncStore.ChangeElements) { if (syncItem.Contact.FileAs == fileAs) { item = syncItem; break; } } } return item; }