/// <summary> /// Capture requirements related with RequestToken within Response element /// </summary> /// <param name="response">The Response information</param> /// <param name="expectedToken">The expected RequestToken</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateResponseToken(Response response, string expectedToken, ITestSite site) { if (expectedToken == null) { // When the expected token is null, then indicating there is no expected token value returned by server. return; } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R65 site.CaptureRequirementIfAreEqual<string>( expectedToken, response.RequestToken, "MS-FSSHTTP", 65, @"[In Request] The one-to-one mapping between the Response element and the Request element MUST be maintained by using RequestToken."); // Directly capture requirement MS-FSSHTTPB_R70, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTP", 70, @"[In Request] Depending on the other types of errors[GenericErrorCodeTypes, CellRequestErrorCodeTypes, DependencyCheckRelatedErrorCodeTypes, LockAndCoauthRelatedErrorCodeTypes and NewEditorsTableCategoryErrorCodeTypes], the error code for that type MUST be returned by the protocol server."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R929 site.CaptureRequirementIfAreEqual<string>( expectedToken, response.RequestToken, "MS-FSSHTTP", 929, @"[In Common Message Processing Rules and Events][The protocol server MUST follow the following common processing rules for all types of subrequests] The protocol server sends a Response element for each Request element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R95 site.CaptureRequirementIfAreEqual<string>( expectedToken, response.RequestToken, "MS-FSSHTTP", 95, @"[In Response] For each Request element that is part of a cell storage service request, there MUST be a corresponding Response element in a cell storage service response."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R105 site.CaptureRequirementIfAreEqual<string>( expectedToken, response.RequestToken, "MS-FSSHTTP", 105, @"[In Response] RequestToken: A nonnegative integer that specifies the request token that uniquely identifies the Request element whose response is being generated."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R108 site.CaptureRequirementIfAreEqual<string>( expectedToken, response.RequestToken, "MS-FSSHTTP", 108, @"[In Response] The one-to-one mapping between the Response element and the Request element MUST be maintained by using the request token."); }
/// <summary> /// Get item value from single Result element of Search command. /// </summary> /// <param name="searchResult">The single Result element of Search command.</param> /// <param name="itemType">The item type.</param> /// <returns>The item value.</returns> private static object GetItemFromSearchResult(Response.SearchResponseStoreResult searchResult, Response.ItemsChoiceType6 itemType) { for (int index = 0; index < searchResult.Properties.ItemsElementName.Length; index++) { if (searchResult.Properties.ItemsElementName[index] == itemType) { return searchResult.Properties.Items[index]; } } return null; }
/// <summary> /// Get the FileReference element of an attachment from search response. /// </summary> /// <param name="result">The result of Search command.</param> /// <returns>The value of FileReference element.</returns> private string GetFileReferenceFromSearchResult(Response.SearchResponseStoreResult result) { string fileReference = null; if (result.Class != null) { for (int i = 0; i < result.Properties.ItemsElementName.Length; i++) { if (result.Properties.ItemsElementName[i] == Response.ItemsChoiceType6.Attachments) { Response.Attachments emailAttachments = result.Properties.Items[i] as Response.Attachments; // Check the attachment exists in the email. Site.Assert.IsNotNull(emailAttachments, "Attachment should be added in the email."); // The attachment number should be 1. Site.Assert.AreEqual<int>(1, emailAttachments.Items.Length, "There should be one attachment in the email, actual {0}.", emailAttachments.Items.Length); fileReference = ((Response.AttachmentsAttachment)emailAttachments.Items[0]).FileReference; } } } return fileReference; }
/// <summary> /// Get element value from Sync response /// </summary> /// <param name="collectionId">The specified collectionId of the folder</param> /// <param name="serverId">The specified serverId</param> /// <param name="elementType">The element type</param> /// <returns>The element value</returns> protected object GetElementValueFromSyncResponse(string collectionId, string serverId, Response.ItemsChoiceType8 elementType) { // Call initial Sync command. SyncResponse syncResponse = this.CallInitialSyncCommand(collectionId); Site.Assert.IsNotNull(TestSuiteHelper.LoadSyncResponse(syncResponse), "The Sync response should not be null."); SyncRequest syncRequest = TestSuiteHelper.GetSyncRequest(collectionId, TestSuiteHelper.LoadSyncResponse(syncResponse).SyncKey); syncRequest.RequestData.WindowSize = "512"; // If there is MoreAvailable tag in the Sync command response, synchronize again to continue getting items from the server. SendStringResponse syncResponseString = null; do { // Get the latest SyncKey. syncRequest.RequestData.Collections[0].SyncKey = TestSuiteHelper.LoadSyncResponse(syncResponse).SyncKey; // Call Sync command by HTTP POST using the SyncKey returned from last sync. syncResponseString = this.HTTPAdapter.HTTPPOST(CommandName.Sync, null, syncRequest.GetRequestDataSerializedXML()); if (!string.IsNullOrEmpty(syncResponseString.ResponseDataXML)) { // Check the command is executed successfully. this.CheckResponseStatus(syncResponseString.ResponseDataXML); // Convert from SendStringResponse to SyncResponse. syncResponse = TestSuiteHelper.ConvertSyncResponseFromSendString(syncResponseString); } } while (syncResponseString.ResponseDataXML.Contains("<MoreAvailable />")); Response.SyncCollections syncCollections = (Response.SyncCollections)syncResponse.ResponseData.Item; Response.SyncCollectionsCollectionCommands commands = null; for (int index = 0; index < syncCollections.Collection[0].ItemsElementName.Length; index++) { if (syncCollections.Collection[0].ItemsElementName[index] == Response.ItemsChoiceType10.Commands) { commands = (Response.SyncCollectionsCollectionCommands)syncCollections.Collection[0].Items[index]; break; } } foreach (Response.SyncCollectionsCollectionCommandsAdd add in commands.Add) { if (add.ServerId == serverId) { for (int itemIndex = 0; itemIndex < add.ApplicationData.ItemsElementName.Length; itemIndex++) { if (add.ApplicationData.ItemsElementName[itemIndex] == elementType) { return add.ApplicationData.Items[itemIndex]; } } } } return null; }
/// <summary> /// Load add commands in sync response. /// </summary> /// <param name="collectionCommands">The add commands response.</param> /// <returns>The list of SyncItem in add commands.</returns> public static Collection<SyncItem> LoadAddCommands(Response.SyncCollectionsCollectionCommands collectionCommands) { if (collectionCommands.Add != null) { Collection<SyncItem> commands = new Collection<SyncItem>(); if (collectionCommands.Add.Length > 0) { foreach (Response.SyncCollectionsCollectionCommandsAdd addCommand in collectionCommands.Add) { SyncItem syncItem = new SyncItem { ServerId = addCommand.ServerId }; for (int i = 0; i < addCommand.ApplicationData.ItemsElementName.Length; i++) { switch (addCommand.ApplicationData.ItemsElementName[i]) { case Response.ItemsChoiceType8.Subject1: syncItem.Subject = addCommand.ApplicationData.Items[i].ToString(); break; case Response.ItemsChoiceType8.Subject: syncItem.Subject = addCommand.ApplicationData.Items[i].ToString(); break; } } commands.Add(syncItem); } } return commands; } else { return null; } }
/// <summary> /// Get the application data of an item specified by field. /// </summary> /// <param name="syncResponse">The Sync command response.</param> /// <param name="field">The element name of the item.</param> /// <param name="fieldValue">The value of the item</param> /// <returns>If the item exists, return its application data; otherwise, return null.</returns> protected static Response.SyncCollectionsCollectionCommandsAddApplicationData GetAddApplicationData(SyncResponse syncResponse, Response.ItemsChoiceType8 field, string fieldValue) { Response.SyncCollectionsCollectionCommandsAddApplicationData addData = null; Response.SyncCollectionsCollectionCommands commands = TestSuiteBase.GetCollectionItem(syncResponse, Response.ItemsChoiceType10.Commands) as Response.SyncCollectionsCollectionCommands; if (commands != null) { foreach (Response.SyncCollectionsCollectionCommandsAdd item in commands.Add) { for (int i = 0; i < item.ApplicationData.ItemsElementName.Length; i++) { if (item.ApplicationData.ItemsElementName[i] == field && item.ApplicationData.Items[i].ToString() == fieldValue) { addData = item.ApplicationData; break; } } } } return addData; }
/// <summary> /// Verify requirements about RightsManagementTemplates /// </summary> /// <param name="rightsManagementTemplatesResponse">The context of rights management templates</param> private void VerifyRightsManagementTemplates(Response.SettingsRightsManagementInformationGet rightsManagementTemplatesResponse) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R137"); // Verify MS-ASRM requirement: MS-ASRM_R137 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 137, @"[In RightsManagementTemplates] The value of this element[RightsManagementTemplates] is a container ([MS-ASDTYPE] section 2.2)."); this.VerifyContainer(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R302"); // Verify MS-ASRM requirement: MS-ASRM_R302 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 302, @"[In RightsManagementTemplates] The RightsManagementTemplates element can only have the following child element: RightsManagementTemplate (section 2.2.2.16). "); int lengthOfArray = rightsManagementTemplatesResponse.RightsManagementTemplates.Length; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R305, the actual number of RightsManagementTemplates element: {0}", lengthOfArray); // Verify MS-ASRM requirement: MS-ASRM_R305 Site.CaptureRequirementIfIsTrue( lengthOfArray < 20, 305, @"[In RightsManagementTemplates] The RightsManagementTemplate elements returned to the client is less than 20."); for (int i = 0; i < lengthOfArray; i++) { this.VerifyRightsManagementTemplate(rightsManagementTemplatesResponse.RightsManagementTemplates[i]); } }
/// <summary> /// This method is used to verify the Recurrence related requirements. /// </summary> /// <param name="recurrence">Specifies when and how often the meeting recurs. </param> private void VerifyRecurrence(Response.MeetingRequestRecurrencesRecurrence recurrence) { this.VerifyContainerStructure(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R653"); // If the schema validation is successful, then MS-ASEMAIL_R653 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R653 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 653, @"[In Recurrence] The Recurrence element can contain the following child elements: [Type, Interval, Until, Occurrences, WeekOfMonth, DayOfMonth, DayOfWeek, MonthOfYear, email2:CalendarType, email2:IsLeapMonth, email2:FirstDayOfWeek]"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R880"); // If the schema validation is successful, then MS-ASEMAIL_R880 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R880 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 880, @"[In Recurrence] Type (section 2.2.2.80): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R789"); // If the schema validation is successful, then MS-ASEMAIL_R789 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R789 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 789, @"[In Type] The Type element is a required child element of the Recurrence element (section 2.2.2.60) that specifies how the meeting recurs."); this.VerifyType(recurrence.Type); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R912"); // If the schema validation is successful, then MS-ASEMAIL_R912 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R912 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 912, @"[In Recurrence] Interval (section 2.2.2.41): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R499"); // If the schema validation is successful, then MS-ASEMAIL_R499 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R499 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 499, @"[In Interval] The Interval element is a required child element of the Recurrence element (section 2.2.2.60) that specifies the interval between meeting recurrences."); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R369 if (recurrence.Type.Equals(2)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R369"); // If the DayOfMonth element is included in Sync command response, then requirement MS-ASEAMIL_R369 can be captured. Site.CaptureRequirementIfIsNotNull( recurrence.DayOfMonth, 369, @"[In DayOfMonth] This element[DayOfMonth] is required when the Type element (section 2.2.2.80) is set to a value of 2 (that is, the meeting recurs monthly on the Nth day of the month),"); } // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R370 if (recurrence.Type.Equals(5)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R370"); // If the DayOfMonth element is included in Sync command response, then requirement MS-ASEAMIL_R370 can be captured. Site.CaptureRequirementIfIsNotNull( recurrence.DayOfMonth, 370, @"[In DayOfMonth] [This element[DayOfMonth] is required when the Type element (section 2.2.2.80) is set to] a value of 5 (that is, the meeting recurs yearly on the Nth day of the Nth month each year)."); } // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R375 if (recurrence.Type.Equals(1)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R375"); // If the DayOfWeek element is included in Sync command response, then requirement MS-ASEAMIL_R375 can be captured. Site.CaptureRequirementIfIsNotNull( recurrence.DayOfWeek, 375, @"[In DayOfWeek] This element[DayOfWeek] is required when the Type element (section 2.2.2.80) is set to a value of 1 (that is, the meeting recurs weekly),"); } // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R376 if (recurrence.Type.Equals(6)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R376"); // If the DayOfWeek element is included in Sync command response, then requirement MS-ASEAMIL_R376 can be captured. Site.CaptureRequirementIfIsNotNull( recurrence.DayOfWeek, 376, @"[In DayOfWeek] [This element[DayOfWeek] is required when the Type element (section 2.2.2.80) is set to]a value of 6 (that is, the meeting recurs yearly on the Nth day of the week of the Nth month each year)."); } this.VerifyInterval(); if (recurrence.Until != null) { this.VerifyUntil(); } if (!string.IsNullOrEmpty(recurrence.Occurrences)) { this.VerifyOccurrences(); } if (!string.IsNullOrEmpty(recurrence.WeekOfMonth)) { this.VerifyWeekOfMonth(); } if (!string.IsNullOrEmpty(recurrence.DayOfMonth)) { this.VerifyDayOfMonth(); } if (!string.IsNullOrEmpty(recurrence.DayOfWeek)) { this.VerifyDayOfWeek(recurrence.DayOfWeek); } if (!string.IsNullOrEmpty(recurrence.MonthOfYear)) { this.VerifyMonthOfYear(); } if (recurrence.CalendarType != null && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { this.VerifyCalendarType(recurrence.CalendarType); } if (recurrence.IsLeapMonthSpecified && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { this.VerifyIsLeapMonth(recurrence.IsLeapMonth); } if (recurrence.FirstDayOfWeekSpecified && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0")) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R420"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R420 Site.CaptureRequirementIfIsTrue( recurrence.FirstDayOfWeek.ToString().Length <= 1, 420, @"[In FirstDayOfWeek] A command response has a maximum of one email2:FirstDayOfWeek child element per Recurrence element."); this.VerifyFirstDayOfWeek(recurrence.FirstDayOfWeek); } }
/// <summary> /// This method is used to verify the MeetingRequest related requirements. /// </summary> /// <param name="meetingRequest">Specifies information about the meeting request. </param> private void VerifyMeetingRequest(Response.MeetingRequest meetingRequest) { if (meetingRequest != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R546"); // If the schema validation is successful, then MS-ASEMAIL_R546 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R546 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 546, @"[In MeetingRequest] The MeetingRequest element can contain the following child elements in a command response:[AllDayEvent, StartTime, DtStamp, EndTime, InstanceType, Location, Organizer, RecurrenceId, Reminder, ResponseRequested, Recurrences, Sensitivity, BusyStatus, TimeZone, GlobalObjId, DisallowNewTimeProposal, MeetingMessageType]"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R541"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R541 Site.CaptureRequirement( 541, @"[In MeetingRequest] The MeetingRequest element is an optional container ([MS-ASDTYPE] section 2.2) element that contains information about the meeting."); this.VerifyRecurrences(meetingRequest.Recurrences); this.VerifyOrganizer(meetingRequest.Organizer); if (meetingRequest.AllDayEventSpecified) { this.VerifyAllDayEvent(meetingRequest.AllDayEvent); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R896"); // If the schema validation is successful, then MS-ASEMAIL_R896 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R896 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 896, @"[In MeetingRequest] StartTime (section 2.2.2.73): One instance of this element is required."); this.VerifyStartTime(meetingRequest.StartTime); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R897"); // If the schema validation is successful, then MS-ASEMAIL_R897 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R897 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 897, @"[In MeetingRequest] DtStamp (section 2.2.2.30): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R401"); // If the schema validation is successful, then MS-ASEMAIL_R401 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R401 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 401, @"[In DtStamp] The DtStamp element is a required child element of the MeetingRequest element (section 2.2.2.48) that specifies the date and time the calendar item was created."); this.VerifyDtStamp(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R898"); // If the schema validation is successful, then MS-ASEMAIL_R898 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R898 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 898, @"[In MeetingRequest] EndTime (section 2.2.2.32): One instance of this element is required."); this.VerifyEndTime(meetingRequest.EndTime); this.VerifyInstanceType(meetingRequest.InstanceType); if (meetingRequest.RecurrenceIdSpecified) { this.VerifyRecurrenceId(); } if (meetingRequest.ResponseRequestedSpecified) { this.VerifyResponseRequested(meetingRequest.ResponseRequested); } this.VerifySensitivity(meetingRequest.Sensitivity); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R682"); // If the schema validation is successful, then MS-ASEMAIL_R682 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R682 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 682, @"[In Recurrences] It[Recurrences] is a child element of the MeetingRequest element (section 2.2.2.48)."); this.VerifyRecurrences(meetingRequest.Recurrences); this.VerifyBusyStatus(meetingRequest.BusyStatus); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R908"); // If the schema validation is successful, then MS-ASEMAIL_R908 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R908 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 908, @"[In MeetingRequest] TimeZone (section 2.2.2.78): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R781"); // If the schema validation is successful, then MS-ASEMAIL_R781 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R781 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 781, @"[In TimeZone] The TimeZone element is a required child element of the MeetingRequest element (section 2.2.2.48) that specifies the time zone specified when the calendar item was created."); this.VerifyTimeZone(); if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0") || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.1")) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R909"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R909 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(meetingRequest.Item) && meetingRequest.ItemElementName == ItemChoiceType.GlobalObjId, 909, @"[In MeetingRequest] GlobalObjId (section 2.2.2.37): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R478"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R478 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(meetingRequest.Item) && meetingRequest.ItemElementName == ItemChoiceType.GlobalObjId, 478, @"[In GlobalObjId] The GlobalObjId element is a required child element of the MeetingRequest element (section 2.2.2.48) that contains a hexadecimal ID generated by the server for the meeting request."); this.VerifyLocation(meetingRequest.Location); } else { if (meetingRequest.Location1 != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1311"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1311 Site.CaptureRequirementIfIsTrue( string.IsNullOrEmpty(meetingRequest.Location), 1311, @"[In MeetingRequest] In protocol version 16.0: The [calendar:UID element is used instead of the email:GlobalObjId element; the] airsyncbase:Location element is used instead of the email:Location element."); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1305"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1305 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(meetingRequest.Item) && meetingRequest.ItemElementName == ItemChoiceType.UID, 1305, @"[In MeetingRequest] calendar:UID ([MS-ASCAL] section 2.2.2.46): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1310"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1310 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(meetingRequest.Item) && meetingRequest.ItemElementName == ItemChoiceType.UID, 1310, @"[In MeetingRequest] In protocol version 16.0: The calendar:UID element is used instead of the email:GlobalObjId element[; the airsyncbase:Location element is used instead of the email:Location element]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1253"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1253 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(meetingRequest.Item) && meetingRequest.ItemElementName == ItemChoiceType.UID, 1253, @"[In GlobalObjId] The server will return the calendar:UID element ([MS-ASCAL] section 2.2.2.46) instead of the GlobalObjId element when protocol version 16.0 is used."); } if (meetingRequest.DisallowNewTimeProposalSpecified && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { this.VerifyDisallowNewTimeProposal(meetingRequest.DisallowNewTimeProposal); } if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1") || !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0")) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R911"); // If the schema validation is successful, then MS-ASEMAIL_R911 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R911 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 911, @"[In MeetingRequest] MeetingMessageType (section 2.2.2.47): One instance of this element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R528"); // If the schema validation is successful, then MS-ASEMAIL_R528 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R528 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 528, @"[In MeetingMessageType] The email2:MeetingMessageType element is a required child element of the MeetingRequest element (section 2.2.2.48) that specifies the type of meeting message."); this.VerifyMeetingMessageType(meetingRequest.MeetingMessageType); } } }
/// <summary> /// Verify the Recurrences element. /// </summary> /// <param name="recurrences">The Recurrences element returned from server.</param> private void VerifyRecurrences(Response.MeetingRequestRecurrences recurrences) { if (recurrences != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R681"); // If the schema validation is successful, then MS-ASEMAIL_R681 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R681 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 681, @"[In Recurrences] The Recurrences element is an optional container ([MS-ASDTYPE] section 2.2) element that contains details about the recurrence pattern of the meeting."); this.VerifyContainerStructure(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R684"); // If the schema validation is successful, then MS-ASEMAIL_R684 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R684 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 684, @"[In Recurrences] The Recurrences element MUST contain the following child element: Recurrence (section 2.2.2.60): This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R652"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R652 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 652, @"[In Recurrence] The Recurrence element is a required child element of the Recurrences element (section 2.2.2.62)."); this.VerifyRecurrence(recurrences.Recurrence); } }
/// <summary> /// This method is used to verify the Flag related requirements. /// </summary> /// <param name="flag">Specifies the flag associated with the item and indicates the item's current status. </param> private void VerifyFlag(Response.Flag flag) { if (flag == null || ((XmlElement)this.LastRawResponseXml).OuterXml.Contains(@"<Flag xmlns=""Email"" />")) { return; } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R434"); // If the schema validation is successful, then MS-ASEMAIL_R434 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R434 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 434, @"[In Flag] The Flag element is an optional container ([MS-ASDTYPE] section 2.2) element that defines the flag associated with the item [and indicates the item's current status]."); this.VerifyContainerStructure(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1069"); // If the flag is not null, then MS-ASEMAIL_R1069 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1069 Site.CaptureRequirement( 1069, @"[In Flag] The Flag element is an optional container ([MS-ASDTYPE] section 2.2) element that [defines the flag associated with the item and] indicates the item's current status."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R436"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R436 Site.CaptureRequirementIfIsTrue( flag.Subject != null || flag.Status != null || flag.FlagType != null || flag.DateCompletedSpecified, 436, @"[In Flag] If flags are present on the e-mail item, the Flag element contains one or more child elements that define the flag."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R440"); // If the schema validation is successful, then MS-ASEMAIL_R440 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R440 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 440, @"[In Flag] The Flag element can contain the following child elements:[tasks:Subject, Status, FlagType, tasks:DateCompleted, CompleteTime, tasks:StartDate, tasks:DueDate, tasks:UtcStartDate, tasks:UtcDueDate, tasks:ReminderSet, tasks:ReminderTime, tasks:OrdinalDate, tasks:SubOrdinalDate]"); this.VerifyTaskSubject(flag.Subject); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R758"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R758 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 758, @"[In Status] A maximum of one Status element is allowed per Flag."); this.VerifyStatus(flag.Status); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R472"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R472 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 472, @"[In FlagType] A maximum of one FlagType child element is allowed per Flag."); this.VerifyFlagType(flag.FlagType); if (flag.DateCompletedSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R359"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R359 // If flag.CompleteTime is not null means server set the CompleteTime element value then MS-ASEMAIL_R359 is verified. Site.CaptureRequirementIfIsNotNull( flag.CompleteTime, 359, @"[In DateCompleted] If a message includes a value for the tasks:DateCompleted element, the CompleteTime element (section 2.2.2.19) is also required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R361"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R361 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 361, @"[In DateCompleted] A maximum of one tasks:DateCompleted child element is allowed per Flag element."); this.VerifyDateCompleted(flag.DateCompleted); } if (flag.CompleteTimeSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R338"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R338 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 338, @"[In CompleteTime] A maximum of one CompleteTime child element is allowed per Flag element."); this.VerifyCompleteTime(); } if (flag.StartDateSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R743"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R743 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 743, @"[In StartDate] A maximum of one tasks:StartDate child element is allowed per Flag element."); this.VerifyStartDate(); } if (flag.DueDateSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R411"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R411 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 411, @"[In DueDate] A maximum of one tasks:DueDate child element is allowed per Flag element."); this.VerifyDueDate(); } if (flag.UtcStartDateSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R866"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R866 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 866, @"[In UtcStartDate] A maximum of one tasks:UtcStartDate child element is allowed per Flag element."); this.VerifyUtcStartDate(); } if (flag.UtcDueDateSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R855"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R855 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 855, @"[In UtcDueDate] A maximum of one tasks:UtcDueDate child element is allowed per Flag element."); this.VerifyUtcDueDate(); } if (flag.ReminderSetSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R694"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R694 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 694, @"[In ReminderSet] A maximum of one tasks:ReminderSet child element is allowed per Flag element."); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R701 if (flag.ReminderSet.Equals(1)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R701"); Site.CaptureRequirementIfIsTrue( flag.ReminderTimeSpecified, 701, @"[In ReminderTime] The tasks:ReminderTime element MUST be set if the tasks:ReminderSet element value is set to 1 (TRUE)."); } this.VerifyReminderSet(flag.ReminderSet); } if (flag.ReminderTimeSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R703"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R703 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 703, @"[In ReminderTime] A maximum of one tasks:ReminderTime child element is allowed per Flag element."); this.VerifyReminderTime(); } if (flag.OrdinalDateSpecified) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R631"); // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R631 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 631, @"[In OrdinalDate] A maximum of one tasks:OrdinalDate child element is allowed per Flag element."); this.VerifyOrdinalDate(); } this.VerifySubOrdinalDate(flag.SubOrdinalDate); }
/// <summary> /// Get element value from Sync response /// </summary> /// <param name="syncResponse">The Sync response</param> /// <param name="serverId">The specified serverId</param> /// <param name="elementType">The element type</param> /// <returns>The element value</returns> protected static object GetElementValueFromSyncResponse(SyncResponse syncResponse, string serverId, Response.ItemsChoiceType8 elementType) { Response.SyncCollections syncCollections = (Response.SyncCollections)syncResponse.ResponseData.Item; Response.SyncCollectionsCollectionCommands commands = null; for (int index = 0; index < syncCollections.Collection[0].ItemsElementName.Length; index++) { if (syncCollections.Collection[0].ItemsElementName[index] == Response.ItemsChoiceType10.Commands) { commands = (Response.SyncCollectionsCollectionCommands)syncCollections.Collection[0].Items[index]; break; } } foreach (Response.SyncCollectionsCollectionCommandsAdd add in commands.Add) { if (add.ServerId == serverId) { for (int itemIndex = 0; itemIndex < add.ApplicationData.ItemsElementName.Length; itemIndex++) { if (add.ApplicationData.ItemsElementName[itemIndex] == elementType) { return add.ApplicationData.Items[itemIndex]; } } } } return null; }
/// <summary> /// Get an object related to a specified ItemsChoiceType10 value. /// </summary> /// <param name="syncResponse">A Sync response.</param> /// <param name="element">An element of ItemsChoiceType10 type, which specifies which object in the Sync response to be retrieved.</param> /// <returns>The object to be retrieved, if it exists in the Sync response; otherwise, return null.</returns> protected static object GetCollectionItem(SyncResponse syncResponse, Response.ItemsChoiceType10 element) { if (syncResponse.ResponseData.Item != null) { Response.SyncCollectionsCollection syncCollection = ((Response.SyncCollections)syncResponse.ResponseData.Item).Collection[0]; for (int i = 0; i < syncCollection.ItemsElementName.Length; i++) { if (syncCollection.ItemsElementName[i] == element) { return syncCollection.Items[i]; } } } return null; }
/// <summary> /// Get elements from Search command response. /// </summary> /// <param name="searchResponse">The Search command response.</param> /// <param name="elementType">The element type need to get.</param> /// <returns>The element object list.</returns> private static List<object> GetElementsFromSearchResponse(SearchResponse searchResponse, Response.ItemsChoiceType6 elementType) { List<object> element = new List<object>(); foreach (Response.SearchResponseStoreResult result in searchResponse.ResponseData.Response.Store.Result) { for (int itemIndex = 0; itemIndex < result.Properties.ItemsElementName.Length; itemIndex++) { if (result.Properties.ItemsElementName[itemIndex] == elementType) { element.Add(result.Properties.Items[itemIndex]); } } } return element; }
/// <summary> /// This method is used to verify the Attachment related requirements. /// </summary> /// <param name="attachment">Specifies an e-mail attachment. </param> private void VerifyAttachment(Response.AttachmentsAttachment attachment) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1122"); // If the schema validation is successful, then MS-ASEMAIL_R1122 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1122 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 1122, @"[In Attachments(Airsyncbase Namespace)] The airsyncbase:Attachments element is a container data type, as specified in [MS-ASDTYPE] section 2.2."); this.VerifyContainerStructure(); if (!string.IsNullOrEmpty(attachment.DisplayName)) { this.VerifyDisplayName(); } if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { this.VerifyUmAttDuration(); this.VerifyUmAttOrder(); } }
/// <summary> /// Capture requirements related with Response element. /// </summary> /// <param name="response">The Response information</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateResponseElement(Response response, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R97 site.CaptureRequirement( "MS-FSSHTTP", 97, @"[In Response][Response element schema is:] <xs:element name=""Response""> <!--Allows for the numbers to be displayed between the SubResponse elements--> <xs:complexType mixed=""true""> <xs:sequence minOccurs=""1"" maxOccurs=""unbounded""> <xs:element name=""SubResponse"" type=""tns:SubResponseElementGenericType"" /> </xs:sequence> <xs:attribute name=""Url"" type=""xs:string"" use=""required""/> <xs:attribute name=""RequestToken"" type=""xs:nonNegativeInteger"" use=""required"" /> <xs:attribute name=""HealthScore"" type=""xs:integer"" use=""required""/> <xs:attribute name=""ErrorCode"" type=""tns:GenericErrorCodeTypes"" use=""optional"" /> <xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/> </xs:complexType> </xs:element>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R104 site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R104, the Url attribute value should be specified, the actual Url value is: {0}", response.Url != null ? response.Url : "NULL"); site.CaptureRequirementIfIsNotNull( response.Url, "MS-FSSHTTP", 104, @"[In Response] The Url attribute MUST be specified for each Response element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1482 // The responseElement.SubResponse.Length specifies the number of SubResponse element in Response. bool isVerifiedR96 = response.SubResponse.Length >= 1; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R1482, the Response element should contain one or more SubResponse elements, the actual SubResponse elements number is: {0}", response.SubResponse.Length.ToString()); site.CaptureRequirementIfIsTrue( isVerifiedR96, "MS-FSSHTTP", 96, @"[In Response] Each Response element MUST contain one or more SubResponse elements."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R107 site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R263, the RequestToken should be specified, the actual RequestToken value is: {0}", response.RequestToken != null ? response.RequestToken : "NULL"); site.CaptureRequirementIfIsNotNull( response.RequestToken, "MS-FSSHTTP", 107, @"[In Response] The RequestToken MUST be specified for each Response element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2076 bool isVerifyR2076 = int.Parse(response.HealthScore) <= 10 && int.Parse(response.HealthScore) >= 0; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2076, the HealthScore value should be between 0 and 10, the actual HealthScore value is: {0}", response.HealthScore); site.CaptureRequirementIfIsTrue( isVerifyR2076, "MS-FSSHTTP", 2076, @"[In Response] HealthScore: An integer which value is between 0 and 10."); // Verify requirements related with SubResponse element if (response.SubResponse != null) { foreach (SubResponseElementGenericType subResponse in response.SubResponse) { ValidateSubResponseElement(subResponse, site); } } // Verify requirements related with GenericErrorCodeTypes if (response.ErrorCodeSpecified) { ValidateGenericErrorCodeTypes(site); } }
/// <summary> /// This method is used to verify the Attachments related requirements. /// </summary> /// <param name="attachments">The attachments get from server response.</param> private void VerifyAttachments(Response.Attachments attachments) { if (attachments != null) { this.VerifyContainerStructure(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R1122"); // If the schema validation is successful, then MS-ASEMAIL_R1122 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R1122 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 1122, @"[In Attachments(Airsyncbase Namespace)] The airsyncbase:Attachments element is a container data type, as specified in [MS-ASDTYPE] section 2.2."); foreach (object attachment in attachments.Items) { if (attachment is AttachmentsAttachment) { this.VerifyAttachment((AttachmentsAttachment)attachment); } } } }
/// <summary> /// Verify requirements about RightsManagementLicense. /// </summary> /// <param name="rightsManagementLicense">The RightsManagementLicense element.</param> private void VerifyRightsManagementLicense(Response.RightsManagementLicense rightsManagementLicense) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R108"); // Verify MS-ASRM requirement: MS-ASRM_R108 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 108, @"[In RightsManagementLicense] The value of this element[RightsManagementLicense] is a container ([MS-ASDTYPE] section 2.2)."); this.VerifyContainer(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R21"); // Verify MS-ASRM requirement: MS-ASRM_R21 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 21, @"[In ContentExpiryDate] The ContentExpiryDate element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R284"); // Verify MS-ASRM requirement: MS-ASRM_R284 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 284, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ContentExpiryDate (section 2.2.2.1). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R27"); // Verify MS-ASRM requirement: MS-ASRM_R27 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 27, @"[In ContentExpiryDate] The value of this element[ContentExpiryDate] is a dateTime ([MS-ASDTYPE] section 2.3)."); this.VerifyDateTime(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R28"); // Verify MS-ASRM requirement: MS-ASRM_R28 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 28, @"[In ContentExpiryDate] The ContentExpiryDate element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R29"); // Verify MS-ASRM requirement: MS-ASRM_R29 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 29, @"[In ContentOwner] The ContentOwner element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R285"); // Verify MS-ASRM requirement: MS-ASRM_R285 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 285, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ContentOwner (section 2.2.2.2). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R32"); // Verify MS-ASRM requirement: MS-ASRM_R32 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 32, @"[In ContentOwner] The value of this element[ContentOwner] is a NonEmptyStringType, as specified in section 2.2."); this.VerifyNonEmptyString(rightsManagementLicense.ContentOwner); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R33"); // Verify MS-ASRM requirement: MS-ASRM_R33 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 33, @"[In ContentOwner] The ContentOwner element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R275, the actual length of ContentOwner element: {0}", rightsManagementLicense.ContentOwner.Length); // Verify MS-ASRM requirement: MS-ASRM_R275 Site.CaptureRequirementIfIsTrue( rightsManagementLicense.ContentOwner.Length < 320, 275, @"[In ContentOwner] The length of the ContentOwner value is less than 320 characters."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R35"); // Verify MS-ASRM requirement: MS-ASRM_R35 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 35, @"[In EditAllowed] The EditAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R286"); // Verify MS-ASRM requirement: MS-ASRM_R286 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 286, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]EditAllowed (section 2.2.2.3). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R37"); // Verify MS-ASRM requirement: MS-ASRM_R37 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 37, @"[In EditAllowed] The value of this element[EditAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); this.VerifyBoolean(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R43"); // Verify MS-ASRM requirement: MS-ASRM_R43 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 43, @"[In EditAllowed] The EditAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R45"); // Verify MS-ASRM requirement: MS-ASRM_R45 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 45, @"[In ExportAllowed] The ExportAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R287"); // Verify MS-ASRM requirement: MS-ASRM_R287 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 287, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ExportAllowed (section 2.2.2.4). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R47"); // Verify MS-ASRM requirement: MS-ASRM_R47 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 47, @"[In ExportAllowed] The value of this element[ExportAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R53"); // Verify MS-ASRM requirement: MS-ASRM_R53 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 53, @"[In ExportAllowed] The ExportAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R54"); // Verify MS-ASRM requirement: MS-ASRM_R54 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 54, @"[In ExtractAllowed] The ExtractAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R288"); // Verify MS-ASRM requirement: MS-ASRM_R288 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 288, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ExtractAllowed (section 2.2.2.5). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R56"); // Verify MS-ASRM requirement: MS-ASRM_R56 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 56, @"[In ExtractAllowed] The value of this element[ExtractAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R58"); // Verify MS-ASRM requirement: MS-ASRM_R58 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 58, @"[In ExtractAllowed] The ExtractAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R59"); // Verify MS-ASRM requirement: MS-ASRM_R59 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 59, @"[In ForwardAllowed] The ForwardAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R289"); // Verify MS-ASRM requirement: MS-ASRM_R289 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 289, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ForwardAllowed (section 2.2.2.6). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R61"); // Verify MS-ASRM requirement: MS-ASRM_R61 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 61, @"[In ForwardAllowed] The value of this element[ForwardAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R63"); // Verify MS-ASRM requirement: MS-ASRM_R63 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 63, @"[In ForwardAllowed] The ForwardAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R64"); // Verify MS-ASRM requirement: MS-ASRM_R64 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 64, @"[In ModifyRecipientsAllowed] The ModifyRecipientsAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R290"); // Verify MS-ASRM requirement: MS-ASRM_R290 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 290, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]ModifyRecipientsAllowed (section 2.2.2.7). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R66"); // Verify MS-ASRM requirement: MS-ASRM_R66 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 66, @"[In ModifyRecipientsAllowed] The value of this element[ModifyRecipientsAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R68"); // Verify MS-ASRM requirement: MS-ASRM_R68 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 68, @"[In ModifyRecipientsAllowed] The ModifyRecipientsAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R69"); // Verify MS-ASRM requirement: MS-ASRM_R69 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 69, @"[In Owner] The Owner element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R291"); // Verify MS-ASRM requirement: MS-ASRM_R291 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 291, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]Owner (section 2.2.2.8). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R71"); // Verify MS-ASRM requirement: MS-ASRM_R71 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 71, @"[In Owner] The value of this element[Owner] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R76"); // Verify MS-ASRM requirement: MS-ASRM_R76 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 76, @"[In Owner] The Owner element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R77"); // Verify MS-ASRM requirement: MS-ASRM_R77 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 77, @"[In PrintAllowed] The PrintAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R292"); // Verify MS-ASRM requirement: MS-ASRM_R292 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 292, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]PrintAllowed (section 2.2.2.9). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R80"); // Verify MS-ASRM requirement: MS-ASRM_R80 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 80, @"[In PrintAllowed] The value of this element[PrintAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R82"); // Verify MS-ASRM requirement: MS-ASRM_R82 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 82, @"[In PrintAllowed] The PrintAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R83"); // Verify MS-ASRM requirement: MS-ASRM_R83 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 83, @"[In ProgrammaticAccessAllowed] The ProgrammaticAccessAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R293"); // Verify MS-ASRM requirement: MS-ASRM_R293 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 293, @"[In RightsManagementLicense][The RightsManagementLicense element can only have the following child elements:]ProgrammaticAccessAllowed (section 2.2.2.10). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R85"); // Verify MS-ASRM requirement: MS-ASRM_R85 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 85, @"[In ProgrammaticAccessAllowed] The value of this element[ProgrammaticAccessAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R89"); // Verify MS-ASRM requirement: MS-ASRM_R89 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 89, @"[In ProgrammaticAccessAllowed] The ProgrammaticAccessAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R96"); // Verify MS-ASRM requirement: MS-ASRM_R96 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 96, @"[In ReplyAllAllowed] The ReplyAllAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R294"); // Verify MS-ASRM requirement: MS-ASRM_R294 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 294, @"[In RightsManagementLicense][The RightsManagementLicense element can only have the following child elements:]ReplyAllAllowed (section 2.2.2.12). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R98"); // Verify MS-ASRM requirement: MS-ASRM_R98 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 98, @"[In ReplyAllAllowed] The value of this element[ReplyAllAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R100"); // Verify MS-ASRM requirement: MS-ASRM_R100 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 100, @"[In ReplyAllAllowed] The ReplyAllAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R101"); // Verify MS-ASRM requirement: MS-ASRM_R101 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 101, @"[In ReplyAllowed] The ReplyAllowed element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R295"); // Verify MS-ASRM requirement: MS-ASRM_R295 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 295, @"[In RightsManagementLicense][The RightsManagementLicense element can only have the following child elements:]ReplyAllowed (section 2.2.2.13). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R103"); // Verify MS-ASRM requirement: MS-ASRM_R103 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 103, @"[In ReplyAllowed] The value of this element[ReplyAllowed] is a boolean ([MS-ASDTYPE] section 2.1)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R105"); // Verify MS-ASRM requirement: MS-ASRM_R105 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 105, @"[In ReplyAllowed] The ReplyAllowed element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R143"); // Verify MS-ASRM requirement: MS-ASRM_R143 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 143, @"[In TemplateDescription (RightsManagementLicense)] The TemplateDescription element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R296"); // Verify MS-ASRM requirement: MS-ASRM_R296 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 296, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]TemplateDescription (section 2.2.2.18.1). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R142"); // Verify MS-ASRM requirement: MS-ASRM_R142 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 142, @"[In TemplateDescription] The value of this element[TemplateDescription] is a NonEmptyStringType, as specified in section 2.2."); this.VerifyNonEmptyString(rightsManagementLicense.TemplateDescription); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R146"); // Verify MS-ASRM requirement: MS-ASRM_R146 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 146, @"[In TemplateDescription (RightsManagementLicense)] The TemplateDescription element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R277, the actual length of TemplateDescription (RightsManagementLicense) element: {0}", rightsManagementLicense.TemplateDescription.Length); // Verify MS-ASRM requirement: MS-ASRM_R277 Site.CaptureRequirementIfIsTrue( rightsManagementLicense.TemplateDescription.Length < 10240, 277, @"[In TemplateDescription (RightsManagementLicense)] The length of the TemplateDescription[RightsManagementLicense] element is less than 10240 characters."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R307"); // Verify MS-ASRM requirement: MS-ASRM_R307 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 307, @"[In TemplateID] The value of this element[TemplateID] is a NonEmptyStringType, as specified in section 2.2."); this.VerifyNonEmptyString(rightsManagementLicense.TemplateID); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R159"); // Verify MS-ASRM requirement: MS-ASRM_R159 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 159, @"[In TemplateID (RightsManagementLicense)] The TemplateID element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R297"); // Verify MS-ASRM requirement: MS-ASRM_R297 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 297, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]TemplateID (section 2.2.2.19.1). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R160"); // Verify MS-ASRM requirement: MS-ASRM_R160 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 160, @"[In TemplateID (RightsManagementLicense)] It[TemplateID] contains a string that identifies the rights policy template represented by the parent RightsManagementLicense element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R161"); // Verify MS-ASRM requirement: MS-ASRM_R161 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 161, @"[In TemplateID (RightsManagementLicense)] The TemplateID element[RightsManagementLicense] has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R172"); // Verify MS-ASRM requirement: MS-ASRM_R172 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 172, @"[In TemplateName] The value of this element[TemplateName] is a NonEmptyStringType, as specified in section 2.2."); this.VerifyNonEmptyString(rightsManagementLicense.TemplateName); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R173"); // Verify MS-ASRM requirement: MS-ASRM_R173 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 173, @"[In TemplateName (RightsManagementLicense)] The TemplateName element is a required child element of the RightsManagementLicense element (section 2.2.2.14)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R298"); // Verify MS-ASRM requirement: MS-ASRM_R298 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 298, @"[In RightsManagementLicense] [The RightsManagementLicense element can only have the following child elements:]TemplateName (section 2.2.2.20.1). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R176"); // Verify MS-ASRM requirement: MS-ASRM_R176 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 176, @"[In TemplateName (RightsManagementLicense)] The TemplateName[RightsManagementLicense] element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R280, the actual length of TemplateName (RightsManagementLicense) element: {0}", rightsManagementLicense.TemplateName.Length); // Verify MS-ASRM requirement: MS-ASRM_R280 Site.CaptureRequirementIfIsTrue( rightsManagementLicense.TemplateName.Length < 256, 280, @"[In TemplateName (RightsManagementLicense)] The length of the TemplateName[RightsManagementLicense] element is less than 256 characters."); }
/// <summary> /// This method is used to verify the Categories related requirements. /// </summary> /// <param name="categories">Specifies a collection of user-selected categories assigned to the e-mail message. </param> private void VerifyCategories(Response.Categories2 categories) { if (categories != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R313"); // If the schema validation is successful, then MS-ASEMAIL_R313 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R313 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 313, @"[In Categories] The Categories element is an optional container ([MS-ASDTYPE] section 2.2) element that specifies a collection of user-selected categories assigned to the e-mail message."); this.VerifyContainerStructure(); if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1")) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASEMAIL_R321"); // If the schema validation is successful, then MS-ASEMAIL_R321 could be captured. // Verify MS-ASEMAIL requirement: MS-ASEMAIL_R321 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 321, @"[In Category] The Category element is an optional child element of the Categories element (section 2.2.2.16) that specifies a category that is assigned to the e-mail item."); this.VerifyCategory(categories.Category); } } }
/// <summary> /// Verify requirements about RightsManagementTemplate included in RightsManagementTemplates. /// </summary> /// <param name="rightsManagementTemplate">The context of rights management template in RightsManagementTemplates element.</param> private void VerifyRightsManagementTemplate(Response.RightsManagementTemplatesRightsManagementTemplate rightsManagementTemplate) { if (rightsManagementTemplate != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R132"); // Verify MS-ASRM requirement: MS-ASRM_R132 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 132, @"[In RightsManagementTemplate] The value of this element[RightsManagementTemplate] is a container ([MS-ASDTYPE] section 2.2)."); this.VerifyContainer(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R148"); // Verify MS-ASRM requirement: MS-ASRM_R148 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 148, @"[In TemplateDescription (RightsManagementTemplate)] The TemplateDescription element is a required child element of the RightsManagementTemplate element (section 2.2.2.16)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R133"); // Verify MS-ASRM requirement: MS-ASRM_R133 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 133, @"[In RightsManagementTemplate] [The RightsManagementTemplate element can have only one of each of the following child elements:] TemplateDescription (section 2.2.2.18.2). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R151"); // Verify MS-ASRM requirement: MS-ASRM_R151 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 151, @"[In TemplateDescription (RightsManagementTemplate)] The TemplateDescription element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R278, the actual length of TemplateDescription element: {0}", rightsManagementTemplate.TemplateDescription.Length); // Verify MS-ASRM requirement: MS-ASRM_R278 Site.CaptureRequirementIfIsTrue( rightsManagementTemplate.TemplateDescription.Length < 10240, 278, @"[In TemplateDescription (RightsManagementTemplate)] The length of the TemplateDescription[RightsManagementTemplate] element is less than 10240 characters."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R162"); // Verify MS-ASRM requirement: MS-ASRM_R162 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 162, @"[In TemplateID (RightsManagementTemplate)] The TemplateID element is a required child element of the RightsManagementTemplate element (section 2.2.2.16)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R163"); // Verify MS-ASRM requirement: MS-ASRM_R163 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 163, @"[In TemplateID (RightsManagementTemplate)] It[TemplateID] contains a string that identifies the rights policy template represented by the parent RightsManagementTempalte element."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R164"); // Verify MS-ASRM requirement: MS-ASRM_R164 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 164, @"[In TemplateID (RightsManagementTemplate)] The TemplateID[RightsManagementTemplate] element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R134"); // Verify MS-ASRM requirement: MS-ASRM_R134 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 134, @"[In RightsManagementTemplate] [The RightsManagementTemplate element can have only one of each of the following child elements:]TemplateID (section 2.2.2.19.2). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R178"); // Verify MS-ASRM requirement: MS-ASRM_R178 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 178, @"[In TemplateName (RightsManagementTemplate)] The TemplateName element is a required child element of the RightsManagementTemplate element (section 2.2.2.16)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R181"); // Verify MS-ASRM requirement: MS-ASRM_R181 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 181, @"[In TemplateName (RightsManagementTemplate)] The TemplateName[RightsManagementTemplate] element has no child elements."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R135"); // Verify MS-ASRM requirement: MS-ASRM_R135 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 135, @"[In RightsManagementTemplate] [The RightsManagementTemplate element can have only one of each of the following child elements:] TemplateName (section 2.2.2.20.2). This element is required."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R279, the actual length of TemplateName element: {0}", rightsManagementTemplate.TemplateName.Length); // Verify MS-ASRM requirement: MS-ASRM_R279 Site.CaptureRequirementIfIsTrue( rightsManagementTemplate.TemplateName.Length < 256, 279, @"[In TemplateName (RightsManagementTemplate)] The length of the TemplateName[RightsManagementTemplate] element is less than 256 characters."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASRM_R317"); // Verify MS-ASRM requirement: MS-ASRM_R317 Site.CaptureRequirementIfIsTrue( this.activeSyncClient.ValidationResult, 317, @"[In RightsManagementTemplate] The RightsManagementTemplate element can have only one of each of the following child elements[TemplateDescription, TemplateID, TemplateName]"); } }
/// <summary> /// Check whether an element of ItemsChoiceType10 type appears in a Sync response. /// </summary> /// <param name="syncResponse">A Sync response.</param> /// <param name="element">The element to be checked.</param> /// <returns>Return true, if the element exists in the Sync response; otherwise, return false.</returns> private static bool CheckElementOfItemsChoiceType10(SyncResponse syncResponse, Response.ItemsChoiceType10 element) { if (TestSuiteBase.GetCollectionItem(syncResponse, element) != null) { return true; } else { return false; } }