public void MSASCMD_S21_TC01_CommonStatusCode_166() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 166 is not returned when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Status value 166 is not returned when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region Call method SendMail to send e-mail messages with invalid AccountID value. string emailSubject = Common.GenerateResourceName(Site, "subject"); // Send email with invalid AccountID value SendMailResponse sendMailResponse = this.SendPlainTextEmail("InvalidAccountID", emailSubject, this.User1Information.UserName, this.User2Information.UserName, null); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4956"); Site.Log.Add(LogEntryKind.Debug, "When sending mail with invalid AccountID, server returns status {0}", sendMailResponse.ResponseData.Status); // Verify MS-ASCMD requirement: MS-ASCMD_R4956 Site.CaptureRequirementIfAreEqual <string>( "166", sendMailResponse.ResponseData.Status, 4956, @"[In Common Status Codes] [The meaning of the status value 166 is] The AccountId (section 2.2.3.3) value is not valid.<100>"); #region Sync user2 mailbox changes // Switch to user2's mailbox this.SwitchUser(this.User2Information); this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); // Record user name, folder collectionId and item subject that is used in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); #endregion }
/// <summary> /// Add a meeting or appointment to server /// </summary> /// <param name="calendar">the calendar item</param> private void SyncAddCalendar(Calendar calendar) { Request.SyncCollectionAddApplicationData applicationData = SetApplicationDataFromCalendar(calendar); this.GetInitialSyncResponse(this.User1Information.CalendarCollectionId); Request.SyncCollectionAdd addCalendar = new Request.SyncCollectionAdd { ClientId = TestSuiteBase.ClientId, ApplicationData = applicationData }; SyncRequest syncAddCalendarRequest = TestSuiteBase.CreateSyncAddRequest(this.LastSyncKey, this.User1Information.CalendarCollectionId, addCalendar); SyncResponse syncAddCalendarResponse = this.CMDAdapter.Sync(syncAddCalendarRequest); // Get data from response Response.SyncCollections syncCollections = (Response.SyncCollections)syncAddCalendarResponse.ResponseData.Item; Response.SyncCollectionsCollectionResponses syncResponses = null; for (int index = 0; index < syncCollections.Collection[0].ItemsElementName.Length; index++) { if (syncCollections.Collection[0].ItemsElementName[index] == Response.ItemsChoiceType10.Responses) { syncResponses = (Response.SyncCollectionsCollectionResponses)syncCollections.Collection[0].Items[index]; break; } } Site.Assert.AreEqual(1, syncResponses.Add.Length, "User only upload one calendar item"); int statusCode = int.Parse(syncResponses.Add[0].Status); Site.Assert.AreEqual(1, statusCode, "If upload calendar item successful, server should return status 1"); }
public void MSASCMD_S21_TC04_CommonStatusCode_105() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The DstFldId element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region User2 sends mail to User1 and do FolderSync in User1's mailbox. string subject = this.SendMailAndFolderSync(); #endregion #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject); string serverId = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject); #endregion #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to recipient information cache. Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove { DstFldId = this.User1Information.RecipientInformationCacheCollectionId, SrcFldId = this.User1Information.InboxCollectionId, SrcMsgId = serverId }; MoveItemsRequest moveItemsRequest = Common.CreateMoveItemsRequest(new Request.MoveItemsMove[] { moveItemsMove }); MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4821"); // Verify MS-ASCMD requirement: MS-ASCMD_R4821 Site.CaptureRequirementIfAreEqual <int>( 105, int.Parse(moveItemsResponse.ResponseData.Response[0].Status), 4821, @"[In Common Status Codes] [The meaning of the status value 105 is] The request contains a combination of parameters that is invalid."); }
public void MSASCMD_S06_TC01_GetAttachment_Success() { Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 14.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region Send a mail with normal attachment string subject = Common.GenerateResourceName(Site, "NormalAttachment_Subject"); string body = Common.GenerateResourceName(Site, "NormalAttachment_Body"); this.SendEmailWithAttachment(subject, body); #endregion this.SwitchUser(this.User2Information); SyncResponse syncResponse = this.GetMailItem(this.User2Information.InboxCollectionId, subject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, subject); Response.AttachmentsAttachment[] attachments = this.GetEmailAttachments(syncResponse, subject); Site.Assert.IsTrue(attachments != null && attachments.Length == 1, "The email should contain a single attachment."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5501"); // Verify MS-ASCMD requirement: MS-ASCMD_R5501 // The attachment name in the sent email is "number1.jpg", so if there is only one attachment in the email and the attachment name is matched, this requirement can be covered. Site.CaptureRequirementIfAreEqual <string>( "number1.jpg", attachments[0].DisplayName, 5501, @"[In GetAttachment] Instead, an Attachment element ([MS-ASAIRS] section 2.2.2.2) is included for each attachment."); #region Call GetAttachment command to fetch attachment string attachmentFileReference = attachments[0].FileReference; IDictionary <CmdParameterName, object> parameters = new Dictionary <CmdParameterName, object>(); parameters.Add(CmdParameterName.AttachmentName, attachmentFileReference); GetAttachmentRequest request = new GetAttachmentRequest(); request.SetCommandParameters(parameters); GetAttachmentResponse response = this.CMDAdapter.GetAttachment(request); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R157"); // Verify MS-ASCMD requirement: MS-ASCMD_R157 // The GetAttachment command response data xml only contains the size information of the attachment, if it is not null and includes the size information, this requirement can be covered. bool isVerifyR157 = !string.IsNullOrEmpty(response.ResponseDataXML) && Convert.ToInt32(response.ResponseDataXML) > 0; Site.CaptureRequirementIfIsTrue( isVerifyR157, 157, @"[In GetAttachment] The GetAttachment command retrieves an email attachment from the server.<2>"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R160"); // Verify MS-ASCMD requirement: MS-ASCMD_R160 // In ExchangeCommonConfiguration.deployment.ptfconfig, HTTP/HTTPS has been specified, so GetAttachment command is issued within the HTTP POST command. Site.CaptureRequirement( 160, @"[In GetAttachment] This command [GetAttachment] is issued within the HTTP POST command."); #endregion }
public void MSASCMD_S04_TC07_FolderSync_AddFolder() { #region The client calls FolderCreate command to create a new folder as a child folder of the specified parent folder, then server returns ServerId for FolderCreate command. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderSync"), "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Call method FolderSync to synchronize the collection hierarchy. FolderSyncResponse folderSyncResponse = this.FolderSync(); bool isVerifyR5860 = false; foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add) { if (add.ServerId == folderCreateResponse.ResponseData.ServerId) { isVerifyR5860 = true; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5860"); // Verify MS-ASCMD requirement: MS-ASCMD_R5860 Site.CaptureRequirementIfIsTrue( isVerifyR5860, 5860, @"[In Add(FolderSync)] [The Add element] creates a new folder on the client."); #endregion }
public void MSASCMD_S02_TC03_FolderCreate_Status2() { #region Call method FolderCreate to create a new folder as a child folder of the mailbox Root folder. string folderName = Common.GenerateResourceName(Site, "FolderCreate", 1); FolderCreateRequest folderCreateRequest = Common.CreateFolderCreateRequest(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "If the FolderCreate command executes successfully, the Status in response should be 1."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Call method FolderCreate to create another new folder with same name as a child folder of the mailbox Root folder. folderCreateRequest = Common.CreateFolderCreateRequest(folderCreateResponse.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4013"); // Verify MS-ASCMD requirement: MS-ASCMD_R4013 Site.CaptureRequirementIfAreEqual <int>( 2, int.Parse(folderCreateResponse.ResponseData.Status), 4013, @"[In Status(FolderCreate)] [When the scope is Item], [the cause of the status value 2 is] The parent folder already contains a folder that has this name."); #endregion }
public void MSASCMD_S10_TC05_MoveItems_Status4() { #region User2 sends mail to User1 and does FolderSync in User1's mailbox. string subject = this.SendMailAndFolderSync(); #endregion #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server. SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject); string serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", subject); #endregion #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to Inbox folder. MoveItemsRequest moveItemsRequest = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.InboxCollectionId); MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest); this.CheckMoveItemsResponse(moveItemsResponse, 1); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4219"); // Verify MS-ASCMD requirement: MS-ASCMD_R4219 Site.CaptureRequirementIfAreEqual <int>( 4, int.Parse(moveItemsResponse.ResponseData.Response[0].Status), 4219, @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 4 is] The client supplied a destination folder that is the same as the source."); #endregion }
public void MSASCMD_S10_TC04_MoveItems_Status2() { #region User2 sends mail to User1 and does FolderSync in User1's mailbox. string subject = this.SendMailAndFolderSync(); #endregion #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server. SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject); string serverId = TestSuiteBase.FindServerId(syncResponse, "Subject", subject); #endregion #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to an invalid destination folder. MoveItemsRequest moveItemsRequest = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, "Invalid DstFldId"); MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest); this.CheckMoveItemsResponse(moveItemsResponse, 1); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4212"); // Verify MS-ASCMD requirement: MS-ASCMD_R4212 Site.CaptureRequirementIfAreEqual <int>( 2, int.Parse(moveItemsResponse.ResponseData.Response[0].Status), 4212, @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 2 is] The destination folder collection ID (CollectionId element value) is not recognized by the server, possibly because the source folder has been deleted."); #endregion }
public void MSASCMD_S05_TC04_FolderUpdate_Status5() { // Call method FolderCreate to create a new folder as a child folder of the specified parent folder. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), "0"); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); // Call method FolderUpdate to move the folder to a nonexistent parent folder. FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderCreateResponse.ResponseData.ServerId, Common.GenerateResourceName(Site, "FolderUpdate"), "InvalidParentId"); FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4108"); // If calls method FolderUpdate to move the folder to a nonexistent parent folder, server will return status 5. // Verify MS-ASCMD requirement: MS-ASCMD_R4108 Site.CaptureRequirementIfAreEqual <int>( 5, int.Parse(folderUpdateResponse.ResponseData.Status), 4108, @"[In Status(FolderUpdate)] [When the scope is] Item, [the meaning of the status value] 5 [is] The specified parent folder was not found."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4109"); // If calls method FolderUpdate to move the folder to a nonexistent parent folder, server will return status 5. // Verify MS-ASCMD requirement: MS-ASCMD_R4109 Site.CaptureRequirementIfAreEqual <int>( 5, int.Parse(folderUpdateResponse.ResponseData.Status), 4109, @"[In Status(FolderUpdate)] [When the scope is Item], [the cause of the status value 5 is] Client specified a nonexistent folder in a FolderUpdate command request."); }
public void MSASCMD_S17_TC02_SmartForward_Fail() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The AccountID element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The AccountID element is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region Call SendMail command to send one plain text email messages to user2. string emailSubject = Common.GenerateResourceName(Site, "subject"); this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null); #endregion #region Call Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); string originalServerId = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject); #endregion #region Record user name, folder collectionId and item subject that are used in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); #endregion #region Call SmartForward command to forward messages without retrieving the full, original message from the server // Create invalid SmartForward request SmartForwardRequest smartForwardRequest = new SmartForwardRequest { RequestData = new Request.SmartForward { ClientId = System.Guid.NewGuid().ToString(), Source = new Request.Source { FolderId = this.User2Information.InboxCollectionId, ItemId = originalServerId }, Mime = string.Empty, AccountId = "InvalidValueAccountID" } }; smartForwardRequest.SetCommandParameters(new Dictionary <CmdParameterName, object> { { CmdParameterName.CollectionId, this.User2Information.InboxCollectionId }, { CmdParameterName.ItemId, "5:" + originalServerId } }); SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4408"); // Verify MS-ASCMD requirement: MS-ASCMD_R4408 // If SmartForward operation failed, server will return Status element in response, then MS-ASCMD_4408 is verified. Site.CaptureRequirementIfIsNotNull( smartForwardResponse.ResponseData.Status, 4408, @"[In Status(SmartForward and SmartReply)] If the SmartForward command request [or SmartReply command request] fails, the Status element contains a code that indicates the type of failure."); }
public void MSASCMD_S18_TC02_SmartReply_Success() { #region Call SendMail command to send one plain text email to user2. string emailSubject = Common.GenerateResourceName(Site, "subject"); this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null); #endregion #region Call Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); string originalServerId = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject); #endregion #region Record user name, folder collectionId and item subject that are useed in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); #endregion #region Call SmartReply command to reply to messages without retrieving the full, original message from the server string smartReplySubject = string.Format("REPLY: {0}", emailSubject); SmartReplyRequest smartReplyRequest = this.CreateDefaultReplyRequest(smartReplySubject, originalServerId); SmartReplyResponse smartReplyResponse = this.CMDAdapter.SmartReply(smartReplyRequest); #endregion #region Call Sync command to sync user1 mailbox changes this.SwitchUser(this.User1Information); this.GetMailItem(this.User1Information.InboxCollectionId, smartReplySubject); #endregion #region Record user name, folder collectionId and item subject that are useed in this case TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, smartReplySubject); #endregion #region Verify Requirements MS-ASCMD_R605, MS-ASCMD_R5776 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R605"); // Verify MS-ASCMD requirement: MS-ASCMD_R605 // If the message was sent successfully, the server won't return any XML data, then MS-ASCMD_R605 is verified. Site.CaptureRequirementIfAreEqual <string>( string.Empty, smartReplyResponse.ResponseDataXML, 605, @"[In SmartReply] If the message was sent successfully, the server returns an empty response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5776"); // Verify MS-ASCMD requirement: MS-ASCMD_R5776 // If the message was sent successfully, the server won't return any XML data, then MS-ASCMD_R776 is verified. Site.CaptureRequirementIfAreEqual <string>( string.Empty, smartReplyResponse.ResponseDataXML, 5776, @"[In Status(SmartForward and SmartReply)] If the [SmartForward command request or] SmartReply command request succeeds, no XML body is returned in the response."); #endregion }
public void MSASCMD_S17_TC07_SmartForward_ReplaceMime() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "ReplaceMime is not support when MS-ASProtocolVersion header is set to 12.1.MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region Call SendMail command to send plain text email messages to user2. string emailSubject = Common.GenerateResourceName(Site, "subject"); string emailBody = Common.GenerateResourceName(Site, "NormalAttachment_Body"); this.SendEmailWithAttachment(emailSubject, emailBody); #endregion #region Call Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); string originalServerID = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject); string originalContent = TestSuiteBase.GetDataFromResponseBodyElement(syncChangeResponse, originalServerID); Response.AttachmentsAttachment[] originalAttachments = this.GetEmailAttachments(syncChangeResponse, emailSubject); Site.Assert.IsTrue(originalAttachments != null && originalAttachments.Length == 1, "The email should contain a single attachment."); #endregion #region Record user name, folder collectionId and item subject that are used in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); #endregion #region Call SmartForward command to forward messages with ReplaceMime. string forwardSubject = string.Format("FW:{0}", emailSubject); SmartForwardRequest smartForwardRequest = this.CreateDefaultForwardRequest(originalServerID, forwardSubject, this.User2Information.InboxCollectionId); smartForwardRequest.RequestData.ReplaceMime = string.Empty; SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); #endregion #region After user2 forwarded email to user3, sync user3 mailbox changes this.SwitchUser(this.User3Information); SyncResponse syncForwardResult = this.GetMailItem(this.User3Information.InboxCollectionId, forwardSubject); string forwardItemServerID = TestSuiteBase.FindServerId(syncForwardResult, "Subject", forwardSubject); string forwardItemContent = TestSuiteBase.GetDataFromResponseBodyElement(syncForwardResult, forwardItemServerID); Response.AttachmentsAttachment[] forwardAttachments = this.GetEmailAttachments(syncForwardResult, forwardSubject); #endregion #region Record user name, folder collectionId and item subject that are used in this case TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User3Information.InboxCollectionId, forwardSubject); #endregion // Compare original content with forward content bool isContained = forwardItemContent.Contains(originalContent); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3775"); Site.Assert.IsNull( forwardAttachments, @"The attachment should not be returned"); Site.CaptureRequirementIfIsFalse( isContained, 3775, @"[In ReplaceMime] When the ReplaceMime element is present, the server MUST not include the body or attachments of the original message being forwarded."); }
public void MSASCMD_S05_TC07_FolderUpdate_Moves() { #region Call method FolderCreate to create a new folder as a child folder of the mailbox Root folder. string folderName = Common.GenerateResourceName(Site, "FolderCreate"); FolderCreateRequest folderCreateRequest = Common.CreateFolderCreateRequest(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); string folderServerId1 = folderCreateResponse.ResponseData.ServerId; TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Call method FolderUpdate to move the new created folder from the mailbox Root folder to SentItems folder on the server. FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderServerId1, folderName, ((byte)FolderType.SentItems).ToString()); FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderUpdateResponse.ResponseData.Status), "Server should return status 1 to indicate FolderUpdate command success."); #endregion #region Call method FolderSync to synchronize the collection hierarchy. FolderSyncResponse folderSyncResponse = this.FolderSync(); bool isFolderMoved = false; foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add) { if ((add.ServerId == folderServerId1) && (add.ParentId == ((byte)FolderType.SentItems).ToString())) { isFolderMoved = true; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R139"); // Verify MS-ASCMD requirement: MS-ASCMD_R139 Site.CaptureRequirementIfIsTrue( isFolderMoved, 139, @"[In FolderUpdate] The FolderUpdate command moves a folder from one location to another on the server."); // Call method FolderCreate to create another new folder which its name is same with above step as a child folder of the mailbox Root folder. folderCreateRequest = Common.CreateFolderCreateRequest(folderSyncResponse.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); // Call method FolderUpdate to move the newest created folder in mailbox Root folder from mailbox Root folder to SentItems folder on the server. folderUpdateRequest = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderCreateResponse.ResponseData.ServerId, folderName, ((byte)FolderType.SentItems).ToString()); folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5438"); // Verify MS-ASCMD requirement: MS-ASCMD_R5438 Site.CaptureRequirementIfAreEqual <int>( 2, int.Parse(folderUpdateResponse.ResponseData.Status), 5438, @"[In Status(FolderUpdate)] [When the scope is Item], [the cause of the status value 2 is] A folder with that name already exists [or the specified folder is a special folder, such as the Inbox, Outbox, Contacts, or Drafts folders. Special folders cannot be updated]."); #endregion }
/// <summary> /// Create default SmartReply request. /// </summary> /// <param name="replySubject">Reply email subject.</param> /// <param name="originalServerId">The server ID of the original email.</param> /// <returns>Smart Reply request.</returns> private SmartReplyRequest CreateDefaultReplyRequest(string replySubject, string originalServerId) { string smartReplyFromUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string smartReplyToUser = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain); string smartReplyContent = Common.GenerateResourceName(Site, "reply:body"); SmartReplyRequest smartReplyRequest = TestSuiteBase.CreateSmartReplyRequest(this.User2Information.InboxCollectionId, originalServerId, smartReplyFromUser, smartReplyToUser, string.Empty, string.Empty, replySubject, smartReplyContent); return(smartReplyRequest); }
public void MSASCMD_S04_TC08_FolderSync_UpdateFolder() { #region Call method FolderCreate command to create a new folder as a child folder of the specified parent folder. string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Change DeviceID this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); string folderSyncKey = folderCreateResponse.ResponseData.SyncKey; #endregion #region Call method FolderSync to synchronize the collection hierarchy. FolderSyncResponse foldersyncResponseForNewDeviceID = this.FolderSync(); string changeDeviceIDFolderId = TestSuiteBase.GetCollectionId(foldersyncResponseForNewDeviceID, folderName); Site.Assert.IsFalse(string.IsNullOrEmpty(changeDeviceIDFolderId), "If the new folder created by FolderCreate command, server should return a server ID for the new created folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5020"); // If client sends the FolderSync request successfully, the server must send a synchronization key to the client in a response. Site.CaptureRequirementIfIsTrue( (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != null) && (foldersyncResponseForNewDeviceID.ResponseData.SyncKey != folderSyncKey), 5020, @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 1:] The server responds with [the folder hierarchy and] a new folderhierarchy:SyncKey value."); #endregion #region Call method FolderUpdate to rename a folder. string folderUpdateName = Common.GenerateResourceName(Site, "FolderUpdate"); FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(foldersyncResponseForNewDeviceID.ResponseData.SyncKey, changeDeviceIDFolderId, folderUpdateName, "0"); this.CMDAdapter.FolderUpdate(folderUpdateRequest); #endregion #region Restore DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); // The client calls FolderSync command to synchronize the collection hierarchy with original device id. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderSyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); bool isUpdated = false; foreach (Response.FolderSyncChangesUpdate update in folderSyncResponse.ResponseData.Changes.Update) { if (update.DisplayName == folderUpdateName) { isUpdated = true; break; } } Site.Assert.IsTrue(isUpdated, "Rename successfully"); #endregion }
public void MSASCMD_S05_TC01_FolderUpdate_Success() { #region Call method FolderCreate command to create a new folder as a child folder of the specified parent folder. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Call method FolderUpdate to rename a folder. string updateFolderName = Common.GenerateResourceName(Site, "FolderUpdate"); FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(folderCreateResponse.ResponseData.SyncKey, folderCreateResponse.ResponseData.ServerId, updateFolderName, "0"); FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest); #endregion #region Call method FolderSync to synchronize the collection hierarchy. FolderSyncResponse folderSyncResponse = this.FolderSync(); bool isFolderRenamed = false; foreach (FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add) { if ((add.DisplayName == updateFolderName) && (add.ServerId == folderCreateResponse.ResponseData.ServerId)) { isFolderRenamed = true; break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R140"); // Verify MS-ASCMD requirement: MS-ASCMD_R140 Site.CaptureRequirementIfIsTrue( isFolderRenamed, 140, @"[In FolderUpdate] The [FolderUpdate] command is also used to rename a folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4100"); // Verify MS-ASCMD requirement: MS-ASCMD_R4100 Site.CaptureRequirementIfAreEqual <string>( "1", folderUpdateResponse.ResponseData.Status, 4100, @"[In Status(FolderUpdate)] [When the scope is Global], [the cause of the status value 1 is] Server successfully completed command."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_ R5784"); // IF folder has been updated successfully, the server must send a synchronization key to the client in a response. Site.CaptureRequirementIfIsNotNull( folderUpdateResponse.ResponseData.SyncKey, 5784, @"[In SyncKey(FolderCreate, FolderDelete, and FolderUpdate)] After a successful [FolderCreate command (section 2.2.2.2), FolderDelete command (section 2.2.2.3), or] FolderUpdate command (section 2.2.2.5), the server MUST send a synchronization key to the client in a response."); #endregion }
public void MSASCMD_S11_TC05_Ping_Status7_Outdate() { #region Change a new user to call ActiveSync operation with a new DeviceID. this.CMDAdapter.SwitchUser(this.User3Information.UserName, this.User3Information.UserPassword, this.User3Information.UserDomain); // Record user that uses new DeviceID this.RecordDeviceInfoChanged(); this.CMDAdapter.ChangeDeviceID("FirstDeviceID"); #endregion #region Sync user folder changes this.FolderSync(); #endregion #region Switch to new device and create one folder this.CMDAdapter.ChangeDeviceID("SecondDeviceID"); string folderSynKey = this.GetFolderSyncKey(); // Create one mail type folder string newFolderName = Guid.NewGuid().ToString().Replace("-", string.Empty); FolderCreateRequest folderCreateRequest = Common.CreateFolderCreateRequest(folderSynKey, 12, newFolderName, this.User1Information.InboxCollectionId); FolderCreateResponse folderCreateResponse = this.CMDAdapter.FolderCreate(folderCreateRequest); Site.Assert.AreEqual <int>( 1, int.Parse(folderCreateResponse.ResponseData.Status), "After folder create success, server should return status 1"); #endregion #region Switch back to old device and send one ping request this.CMDAdapter.ChangeDeviceID("FirstDeviceID"); PingRequest pingRequest = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email); PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4257"); // Verify MS-ASCMD requirement: MS-ASCMD_R4257 Site.CaptureRequirementIfAreEqual <int>( 7, int.Parse(pingResponse.ResponseData.Status), 4257, @"[In Status(Ping)] [When the scope is Global], [the cause of the status value 7 is] The folder hierarchy is out of date."); #region Record new created folder collection ID. // Get new created folder collection ID FolderSyncRequest folderSyncRequestForNewFolder = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponseForNewFolder = this.CMDAdapter.FolderSync(folderSyncRequestForNewFolder); // Gets the server ID for new folder after change DeviceID. string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewFolder, newFolderName); TestSuiteBase.RecordCaseRelativeFolders(this.User3Information, serverId); #endregion }
public void MSASCMD_S18_TC03_SmartReply_Status104() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region User1 calls SendMail command to send one recurring meeting request to user2. string meetingRequestSubject = Common.GenerateResourceName(Site, "subject"); string attendeeEmailAddress = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); this.SendWeeklyRecurrenceMeetingRequest(meetingRequestSubject, attendeeEmailAddress); #endregion #region User2 calls Sync command to sync user2 mailbox changes. this.SwitchUser(this.User2Information); this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject); SyncResponse syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject); string calendarItemID = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject); #endregion #region User2 creates SmartReply request with invalid InstanceId value, then calls SmartReply command. // Set instanceID with format that is not the same as required "2010-03-20T22:40:00.000Z". string instanceID = DateTime.Now.ToString(); string smartReplySubject = string.Format("REPLY: {0}", meetingRequestSubject); SmartReplyRequest smartReplyRequest = this.CreateDefaultReplyRequest(smartReplySubject, calendarItemID); // Add instanceId element to smartReplyRequest. smartReplyRequest.RequestData.Source.InstanceId = instanceID; smartReplyRequest.RequestData.Source.FolderId = this.User2Information.CalendarCollectionId; SmartReplyResponse smardReplyResponse = this.CMDAdapter.SmartReply(smartReplyRequest); #endregion #region Verify Requirements MS-ASCMD_R5777, MS-ASCMD_R578 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5777"); // Verify MS-ASCMD requirement: MS-ASCMD_R5777 // If server returns status code which has value, that indicates the type of failure then MS-ASCMD_R5777 is verified. Site.CaptureRequirementIfIsNotNull( smardReplyResponse.ResponseData.Status, 5777, @"[In Status(SmartForward and SmartReply)] If the [SmartForward command request or ] SmartReply command request fails, the Status element contains a code that indicates the type of failure."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R578"); // Verify MS-ASCMD requirement: MS-ASCMD_R578 Site.CaptureRequirementIfAreEqual <string>( "104", smardReplyResponse.ResponseData.Status, 578, @"[In SmartReply] If the value of the InstanceId element is invalid, the server responds with Status element (section 2.2.3.162.15) value 104, as specified in section 2.2.4."); #endregion }
public void MSASCMD_S17_TC03_SmartForwardAppointment() { #region User1 calls Sync command uploading one calendar item to create one appointment string meetingRequestSubject = Common.GenerateResourceName(Site, "subject"); Calendar calendar = new Calendar { OrganizerEmail = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain), OrganizerName = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain), UID = Guid.NewGuid().ToString(), Subject = meetingRequestSubject }; this.SyncAddCalendar(calendar); // Calls Sync command to sync user1's calendar folder SyncResponse syncUser1CalendarFolder = this.GetMailItem(this.User1Information.CalendarCollectionId, meetingRequestSubject); string calendarItemId = TestSuiteBase.FindServerId(syncUser1CalendarFolder, "Subject", meetingRequestSubject); // Record items need to be cleaned up. TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, meetingRequestSubject); #endregion #region User1 calls smartForward command to forward mail to user2 string forwardFromUser = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain); string forwardToUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string forwardSubject = string.Format("FW:{0}", meetingRequestSubject); string forwardContent = Common.GenerateResourceName(Site, "forward:Appointment body"); SmartForwardRequest smartForwardRequest = this.CreateSmartForwardRequest(this.User1Information.CalendarCollectionId, calendarItemId, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent); SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); Site.Assert.AreEqual(string.Empty, smartForwardResponse.ResponseDataXML, "If SmartForward command executes successfully, server should return empty xml data"); #endregion #region User2 calls Sync command to get the forward mail sent by user1 this.SwitchUser(this.User2Information); SyncResponse user2MailboxChange = this.GetMailItem(this.User2Information.InboxCollectionId, forwardSubject); // Record items need to be cleaned up. TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, forwardSubject); string mailItemServerId = TestSuiteBase.FindServerId(user2MailboxChange, "Subject", forwardSubject); Response.Attachments attachments = (Response.Attachments)TestSuiteBase.GetElementValueFromSyncResponse(user2MailboxChange, mailItemServerId, Response.ItemsChoiceType8.Attachments); Site.Assert.AreEqual <int>(1, attachments.Items.Length, "Server should return one attachment, if SmartForward one appointment executes successfully."); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R542"); // Verify MS-ASCMD requirement: MS-ASCMD_R542 Site.CaptureRequirementIfIsTrue( attachments.Items.Length == 1 && ((Response.AttachmentsAttachment)attachments.Items[0]).DisplayName.Contains(".eml"), 542, @"[In SmartForward] When the SmartForward command is used for an appointment, the original message is included by the server as an attachment to the outgoing message."); }
public void MSASCMD_S04_TC09_FolderSync_DeleteFolder() { #region The client calls FolderCreate command to create a new folder as a child folder of the specified parent folder, then server returns ServerId for FolderCreate command. string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); #endregion #region Changes DeviceID. this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); #endregion #region Calls method FolderSync to synchronize the collection hierarchy. FolderSyncRequest folderSyncRequestForNewDeviceID = Common.CreateFolderSyncRequest("0"); FolderSyncResponse folderSyncResponseForNewDeviceID = this.CMDAdapter.FolderSync(folderSyncRequestForNewDeviceID); // Gets the server ID for new folder after change DeviceID. string serverId = TestSuiteBase.GetCollectionId(folderSyncResponseForNewDeviceID, folderName); Site.Assert.IsNotNull(serverId, "Call method GetServerId to get a non-null ServerId to indicate success."); #endregion #region The client calls FolderDelete command to delete the created folder in step 2 from the server. FolderDeleteRequest folderDeleteRequest = Common.CreateFolderDeleteRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, serverId); FolderDeleteResponse folderDeleteResponse = this.CMDAdapter.FolderDelete(folderDeleteRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderDeleteResponse.ResponseData.Status), "The server should return a status code 1 in the FolderDelete command response to indicate success."); #endregion #region Restore DeviceID and call FolderSync command this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); // The client calls FolderSync command to synchronize the collection hierarchy with original device id. FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderCreateResponse.ResponseData.SyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); Site.Assert.AreEqual <int>(1, int.Parse(folderSyncResponse.ResponseData.Status), "Server should return status 1 in the FolderSync response to indicate success."); Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes, "Server should return Changes element in the FolderSync response after the collection hierarchy changed by call FolderDelete command."); Site.Assert.IsNotNull(folderSyncResponse.ResponseData.Changes.Delete, "Server should return Changes element in the FolderSync response after the specified folder deleted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5863"); // The folderDeleteSuccess is true indicates the folder which deleted by FolderDelete command is deleted successfully. // Verify MS-ASCMD requirement: MS-ASCMD_R5863 Site.CaptureRequirementIfIsNotNull( folderSyncResponse.ResponseData.Changes.Delete[0].ServerId, 5863, @"[In Delete(FolderSync)] [The Delete element] specifies that a folder on the server was deleted since the last folder synchronization."); #endregion }
public void MSASCMD_S10_TC07_MoveItems_Status103() { Site.Assume.IsTrue(Common.IsRequirementEnabled(5671, this.Site), "Exchange 2007 does not limit the number of elements in command requests."); #region User2 sends mail to User1 and does FolderSync in User1's mailbox. string subject = this.SendMailAndFolderSync(); #endregion #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject); TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject); string syncKeyInbox = this.LastSyncKey; string serverId = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject); #endregion #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server, and get the SyncKey this.SyncChanges(this.User1Information.DeletedItemsCollectionId); string syncKeyDeletedItems = this.LastSyncKey; #endregion #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to DeletedItems folder. Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove { DstFldId = this.User1Information.DeletedItemsCollectionId, SrcFldId = this.User1Information.InboxCollectionId, SrcMsgId = serverId }; Request.MoveItems moveItems = new Request.MoveItems(); moveItems.Move = new Request.MoveItemsMove[1001]; for (int i = 0; i <= 1000; i++) { moveItems.Move[i] = moveItemsMove; } MoveItemsRequest request = new MoveItemsRequest(); Request.MoveItems requestData = moveItems; request.RequestData = requestData; MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(request); this.Site.CaptureRequirementIfAreEqual <int>( 103, int.Parse(moveItemsResponse.ResponseData.Status), 5653, @"[In Limiting Size of Command Requests] In MoveItems (section 2.2.2.11) command request, when the limit value of Move element is bigger than 1000 (minimum 1, maximum 2,147,483,647), the error returned by server is Status element (section 2.2.3.167.9) value of 103."); #endregion }
public void MSASCMD_S11_TC08_Ping_WithoutRequestBody() { #region Call Ping command with request body PingRequest pingRequest = CreatePingRequest(this.User1Information.InboxCollectionId, Request.PingFolderClass.Email); pingRequest.RequestData.HeartbeatInterval = "60"; PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest); // According to techinical specification, if there were changes occurred in the Inbox folder, the Ping response would return 2. // Reissue the Ping command when the Sync command completes to stay up to date. int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int counter = 1; while (counter < retryCount && 2 == int.Parse(pingResponse.ResponseData.Status)) { System.Threading.Thread.Sleep(waitTime); SyncRequest syncRequest = TestSuiteBase.CreateEmptySyncRequest(this.User1Information.InboxCollectionId); this.Sync(syncRequest); syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey; this.Sync(syncRequest); pingResponse = this.CMDAdapter.Ping(pingRequest); counter++; } Site.Assert.AreEqual <int>(1, int.Parse(pingResponse.ResponseData.Status), "The Ping command should be successful."); #endregion #region Create a ping request without request body pingRequest = new PingRequest(); pingRequest.RequestData = null; #endregion #region Call Ping command pingResponse = this.CMDAdapter.Ping(pingRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R335"); // Verify MS-ASCMD requirement: MS-ASCMD_R335 Site.CaptureRequirementIfAreEqual <int>( 1, int.Parse(pingResponse.ResponseData.Status), 335, @"[In Ping] A Ping command can be sent with no body, in which case the cached version is used."); #endregion }
public void MSASCMD_S05_TC06_FolderUpdate_Status10() { #region Call method FolderCreate to create a new folder as a child folder of the specified parent folder. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(this.LastFolderSyncKey, (byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate"), "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Call method FolderUpdate to rename the created folder without SyncKey element. FolderUpdateRequest folderUpdateRequest = Common.CreateFolderUpdateRequest(null, folderCreateResponse.ResponseData.ServerId, Common.GenerateResourceName(Site, "FolderUpdate"), "0"); FolderUpdateResponse folderUpdateResponse = this.CMDAdapter.FolderUpdate(folderUpdateRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3102"); // The server should return a status code 10 in the FolderUpdate command response to indicate the client sent FolderUpdate request contains a semantic error. // Verify MS-ASCMD requirement: MS-ASCMD_R3102 Site.CaptureRequirementIfAreEqual <int>( 10, int.Parse(folderUpdateResponse.ResponseData.Status), 3102, @"[In FolderUpdate] Including the Status element in a FolderUpdate request results in a Status element value of 10 being returned in the response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4123"); // The server should return a status code 10 in the FolderUpdate command response to indicate the client sent FolderUpdate request contains a semantic error. // Verify MS-ASCMD requirement: MS-ASCMD_R4123 Site.CaptureRequirementIfAreEqual <int>( 10, int.Parse(folderUpdateResponse.ResponseData.Status), 4123, @"[In Status(FolderUpdate)] [When the scope is Global], [the cause of the status value 10 is] The client sent a FolderUpdate command request that contains a semantic error."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4568"); // The server should return a status code 10 in the FolderUpdate command response to indicate the client sent FolderUpdate request does not contain SyncKey element. // Verify MS-ASCMD requirement: MS-ASCMD_R4568 Site.CaptureRequirementIfAreEqual <int>( 10, int.Parse(folderUpdateResponse.ResponseData.Status), 4568, @"[In SyncKey(FolderCreate, FolderDelete, and FolderUpdate)] The server returns a Status element (section 2.2.3.162.5) value of 10 if the SyncKey element is not included in a FolderUpdate command request."); #endregion }
public void MSASCMD_S04_TC03_FolderSync_Changed() { #region Change a new DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); FolderSyncResponse folderSyncResponseForDefaultDeviceID = this.FolderSync(); #endregion #region Change a new DeviceID and call FolderSync command. this.CMDAdapter.ChangeDeviceID("NewDeviceID"); this.RecordDeviceInfoChanged(); string folderName = Common.GenerateResourceName(Site, "FolderSync"); FolderSyncResponse folderSyncResponseForNewDeviceID = this.FolderSync(); #endregion #region Call method FolderCreate to create a new folder as a child folder of the specified parent folder. FolderCreateResponse folderCreateResponse = this.GetFolderCreateResponse(folderSyncResponseForNewDeviceID.ResponseData.SyncKey, (byte)FolderType.UserCreatedMail, folderName, "0"); Site.Assert.AreEqual <int>(1, int.Parse(folderCreateResponse.ResponseData.Status), "The server should return a status code 1 in the FolderCreate command response to indicate success."); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, folderCreateResponse.ResponseData.ServerId); #endregion #region Change the DeviceId back and call method FolderSync to synchronize the collection hierarchy. this.CMDAdapter.ChangeDeviceID(Common.GetConfigurationPropertyValue("DeviceID", this.Site)); FolderSyncRequest folderSyncRequest = Common.CreateFolderSyncRequest(folderSyncResponseForNewDeviceID.ResponseData.SyncKey); FolderSyncResponse folderSyncResponse = this.CMDAdapter.FolderSync(folderSyncRequest); foreach (Response.FolderSyncChangesAdd add in folderSyncResponse.ResponseData.Changes.Add) { if (add.DisplayName == folderName) { this.User1Information.UserCreatedFolders.Clear(); TestSuiteBase.RecordCaseRelativeFolders(this.User1Information, add.ServerId); break; } } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5024"); // Verify MS-ASCMD requirement: MS-ASCMD_R5024 Site.CaptureRequirementIfAreEqual <uint>( (uint)1, folderSyncResponse.ResponseData.Changes.Count, 5024, @"[In Synchronizing a Folder Hierarchy] [FolderSync sequence for folder hierarchy synchronization, order 2:] If any changes have occurred on the server, the new, deleted, or changed folders are returned to the client."); #endregion }
public void MSASCMD_S17_TC04_SmartForwardWithInvalidInstanceId() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.0"); Site.Assume.AreNotEqual <string>("16.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.1"); #region User1 calls SendMail command to send one recurring meeting request to user2. string meetingRequestSubject = Common.GenerateResourceName(Site, "subject"); string attendeeEmailAddress = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); this.SendWeeklyRecurrenceMeetingRequest(meetingRequestSubject, attendeeEmailAddress); #endregion #region User2 calls Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject); SyncResponse syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject); string calendarItemID = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject); #endregion #region User2 calls SmartForward command to forward the calendar item to user3 with invalid InstanceId value in SmartForward request string forwardFromUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string forwardToUser = Common.GetMailAddress(this.User3Information.UserName, this.User3Information.UserDomain); string forwardSubject = string.Format("FW:{0}", meetingRequestSubject); string forwardContent = Common.GenerateResourceName(Site, "forward:Meeting Instance body"); SmartForwardRequest smartForwardRequest = this.CreateSmartForwardRequest(this.User2Information.CalendarCollectionId, calendarItemID, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent); // Set instanceID with format not the same as required format "2010-03-20T22:40:00.000Z". string instanceID = DateTime.Now.ToString(); smartForwardRequest.RequestData.Source.InstanceId = instanceID; SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R541"); // Verify MS-ASCMD requirement: MS-ASCMD_R541 Site.CaptureRequirementIfAreEqual <string>( "104", smartForwardResponse.ResponseData.Status, 541, @"[In SmartForward] If the value of the InstanceId element is invalid, the server responds with Status element (section 2.2.3.162.15) value 104, as specified in section 2.2.4."); }
public void MSASCMD_S17_TC03_SmartForwardAppointment() { #region User1 calls Sync command uploading one calendar item to create one appointment string meetingRequestSubject = Common.GenerateResourceName(Site, "subject"); Calendar calendar = new Calendar { OrganizerEmail = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain), OrganizerName = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain), UID = Guid.NewGuid().ToString(), Subject = meetingRequestSubject }; this.SyncAddCalendar(calendar); // Calls Sync command to sync user1's calendar folder SyncResponse syncUser1CalendarFolder = this.GetMailItem(this.User1Information.CalendarCollectionId, meetingRequestSubject); string calendarItemId = TestSuiteBase.FindServerId(syncUser1CalendarFolder, "Subject", meetingRequestSubject); // Record items need to be cleaned up. TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, meetingRequestSubject); #endregion #region User1 calls smartForward command to forward mail to user2 string forwardFromUser = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain); string forwardToUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string forwardSubject = string.Format("FW:{0}", meetingRequestSubject); string forwardContent = Common.GenerateResourceName(Site, "forward:Appointment body"); SmartForwardRequest smartForwardRequest = this.CreateSmartForwardRequest(this.User1Information.CalendarCollectionId, calendarItemId, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent); SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); Site.Assert.AreEqual(string.Empty, smartForwardResponse.ResponseDataXML, "If SmartForward command executes successfully, server should return empty xml data"); #endregion #region User2 calls Sync command to get the forward mail sent by user1 this.SwitchUser(this.User2Information); SyncResponse user2MailboxChange = this.GetMailItem(this.User2Information.InboxCollectionId, forwardSubject); // Record items need to be cleaned up. TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, forwardSubject); string mailItemServerId = TestSuiteBase.FindServerId(user2MailboxChange, "Subject", forwardSubject); Response.Attachments attachments = (Response.Attachments)TestSuiteBase.GetElementValueFromSyncResponse(user2MailboxChange, mailItemServerId, Response.ItemsChoiceType8.Attachments); Site.Assert.AreEqual <int>(1, attachments.Items.Length, "Server should return one attachment, if SmartForward one appointment executes successfully."); #endregion }
public void MSASCMD_S21_TC14_CommonStatusCode_145() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "This test case is not supported when the MS-ASProtocolVersion header is set to 12.1.. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region User calls Provision command to download policies from server // Calls Provision command to download policies ProvisionRequest provisionRequest = TestSuiteBase.GenerateDefaultProvisionRequest(); ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest); // Get policyKey, policyType and statusCode from server response string policyKey = null; if (null != provisionResponse.ResponseData.Policies) { Response.ProvisionPoliciesPolicy policyInResponse = provisionResponse.ResponseData.Policies.Policy; if (policyInResponse != null) { policyKey = policyInResponse.PolicyKey; } } string policyType = provisionResponse.ResponseData.Policies.Policy.PolicyType; Response.ProvisionPoliciesPolicyData data = provisionResponse.ResponseData.Policies.Policy.Data; byte statusCode = provisionResponse.ResponseData.Status; #endregion #region User calls Provision command to acknowledge policies. // Set acknowledgeStatus value to 1, means accept the policy. ProvisionRequest provisionAcknowledgeRequest = TestSuiteBase.GenerateDefaultProvisionRequest(); provisionAcknowledgeRequest.RequestData.Policies.Policy.PolicyKey = policyKey; provisionAcknowledgeRequest.RequestData.Policies.Policy.Status = "4"; // Calls Provision command ProvisionResponse provisionAcknowledgeResponse = this.CMDAdapter.Provision(provisionAcknowledgeRequest); statusCode = provisionAcknowledgeResponse.ResponseData.Status; this.Site.CaptureRequirementIfAreEqual <byte>( 145, statusCode, 4917, @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0, [The meaning of the status value 145 is] The device claimed to be externally managed, but the server doesn't allow externally managed devices to sync."); #endregion }
public void MSASCMD_S21_TC13_CommonStatusCode_150() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "This test case is not supported when the MS-ASProtocolVersion header is set to 12.1.. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region Call SendMail command to send plain text email messages to user2. string emailSubject = Common.GenerateResourceName(Site, "subject"); this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null); #endregion #region Call Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); string originalServerID = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject); string originalContent = TestSuiteBase.GetDataFromResponseBodyElement(syncChangeResponse, originalServerID); #endregion #region Record user name, folder collectionId and item subject that are used in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); #endregion #region Call Sync command to delete the email in user2's mailbox. SyncRequest syncRequest = TestSuiteBase.CreateSyncDeleteRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, originalServerID); syncRequest.RequestData.Collections[0].DeletesAsMoves = false; syncRequest.RequestData.Collections[0].DeletesAsMovesSpecified = true; this.Sync(syncRequest); #endregion #region Call SmartForward command to forward messages without retrieving the full, original message from the server. string forwardSubject = string.Format("FW:{0}", emailSubject); string forwardFromUser = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string forwardToUser = Common.GetMailAddress(this.User3Information.UserName, this.User3Information.UserDomain); string forwardContent = Common.GenerateResourceName(Site, "forward:body"); SmartForwardRequest smartForwardRequest = this.CreateSmartForwardRequest(this.User2Information.InboxCollectionId, originalServerID, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent); SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); #endregion this.Site.CaptureRequirementIfAreEqual <int>( 150, int.Parse(smartForwardResponse.ResponseData.Status), 4930, @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0, [The meaning of the status value 150 is] The value of either the ItemId element (section 2.2.3.88) or the InstanceId element (section 2.2.3.87.2) specified in the SmartReply (section 2.2.2.19) or the SmartForward (section 2.2.2.18) command request could not be found in the mailbox."); }
public void MSASCMD_S12_TC02_Provision_WithoutPolicyTypeElement() { #region User calls Provision command to download policies without policy type element in request. ProvisionRequest provisionRequest = TestSuiteBase.GenerateDefaultProvisionRequest(); // Set the policy type Element value to null provisionRequest.RequestData.Policies.Policy.PolicyType = null; ProvisionResponse provisionResponse = this.CMDAdapter.Provision(provisionRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4989"); // Verify MS-ASCMD requirement: MS-ASCMD_R4989 Site.CaptureRequirementIfAreEqual <int>( 2, provisionResponse.ResponseData.Status, 4989, @"[In Downloading Policy Settings] If the provision:PolicyType element is not included in the initial Provision command request, the server responds with a provision:Status element value of 2."); #endregion }
public void MSASCMD_S21_TC06_CommonStatusCode_118() { Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "This test case is not supported when the MS-ASProtocolVersion header is set to 12.1.. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion."); #region User1 calls SendMail command to send email messages to user2. string emailSubject = Common.GenerateResourceName(Site, "subject"); string from = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain); string to = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain); string content = Common.GenerateResourceName(Site, "Default Email"); string mime = Common.CreatePlainTextMime(from, to, null, null, emailSubject, content); SendMailRequest sendMailRequest = Common.CreateSendMailRequest(TestSuiteBase.ClientId, false, mime); SendMailResponse responseSendMail = this.CMDAdapter.SendMail(sendMailRequest); Site.Assert.AreEqual <string>( string.Empty, responseSendMail.ResponseDataXML, "The server should return an empty xml response data to indicate SendMail command success."); this.SwitchUser(this.User2Information); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject); this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject); this.SwitchUser(this.User1Information); #endregion #region User1 calls SendMail command with the same ClientId again. // Use the same ClientId to call SendMail command again responseSendMail = this.CMDAdapter.SendMail(sendMailRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4848"); // Verify MS-ASCMD requirement: MS-ASCMD_R4848 Site.CaptureRequirementIfAreEqual <string>( "118", responseSendMail.ResponseData.Status, 4848, @"[In Common Status Codes] [The meaning of the status value 118 is] The message was already sent in a previous request."); #endregion }