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_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_S17_TC01_SmartForward_Success() { #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 SmartForward command to forward messages without retrieving the full, original message from the server. string forwardSubject = string.Format("FW:{0}", emailSubject); SmartForwardRequest smartForwardRequest = this.CreateDefaultForwardRequest(originalServerID, forwardSubject, this.User2Information.InboxCollectionId); SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest); #endregion #region Verify Requirements MS-ASCMD_R568, MS-ASCMD_R4407 // If the message was forwarded successfully, server returns an empty response without XML body, then MS-ASCMD_R568, MS-ASCMD_R4407 are verified. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R568"); // Verify MS-ASCMD requirement: MS-ASCMD_R568 Site.CaptureRequirementIfAreEqual <string>( string.Empty, smartForwardResponse.ResponseDataXML, 568, @"[In SmartForward] If the message was forwarded successfully, the server returns an empty response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4407"); // Verify MS-ASCMD requirement: MS-ASCMD_R4407 Site.CaptureRequirementIfAreEqual <string>( string.Empty, smartForwardResponse.ResponseDataXML, 4407, @"[In Status(SmartForward and SmartReply)] If the SmartForward command request [or SmartReply command request] succeeds, no XML body is returned in the response."); #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); #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); #region Verify Requirements MS-ASCMD_R543, MS-ASCMD_R532 // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R543"); // Verify MS-ASCMD requirement: MS-ASCMD_R543 Site.CaptureRequirementIfIsTrue( isContained, 543, @"[In SmartForward] When the SmartForward command is used for a normal message or a meeting, the behavior of the SmartForward command is the same as that of the SmartReply command (section 2.2.2.18)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R532"); // Verify MS-ASCMD requirement: MS-ASCMD_R532 Site.CaptureRequirementIfIsNotNull( forwardItemServerID, 532, @"[In SmartForward] The SmartForward command is used by clients to forward messages without retrieving the full, original message from the server."); #endregion }
public void MSASCMD_S18_TC01_SmartReply_ContainOriginalMessage() { 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"); #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 Call Sync command to sync user2 mailbox changes this.SwitchUser(this.User2Information); SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject); SyncResponse syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject); string calendarItemID = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject); // Get User2 original mail content string originalServerId = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", meetingRequestSubject); string originalContent = TestSuiteBase.GetDataFromResponseBodyElement(syncChangeResponse, originalServerId); #endregion #region Record user name, folder collectionId and item subject that are useed in this case TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject); TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject); #endregion #region Call SmartReply command to reply to messages without instanceID in request string smartReplySubject = string.Format("REPLY: {0}", meetingRequestSubject); SmartReplyRequest smartReplyRequest = this.CreateDefaultReplyRequest(smartReplySubject, calendarItemID); // Add elements to smartReplyRequest smartReplyRequest.RequestData.Source.InstanceId = null; smartReplyRequest.RequestData.Source.FolderId = this.User2Information.CalendarCollectionId; smartReplyRequest.RequestData.Source.ItemId = calendarItemID; this.CMDAdapter.SmartReply(smartReplyRequest); #endregion #region Call Sync command to sync user1 mailbox changes this.SwitchUser(this.User1Information); SyncResponse syncResponseOnUserOne = this.GetMailItem(this.User1Information.InboxCollectionId, smartReplySubject); // Get replied mail content string replyMailServerId = TestSuiteBase.FindServerId(syncResponseOnUserOne, "Subject", smartReplySubject); string replyMailContent = TestSuiteBase.GetDataFromResponseBodyElement(syncResponseOnUserOne, replyMailServerId); #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_R5420, MS-ASCMD_R580, MS-ASCMD_R569 if (Common.IsRequirementEnabled(5420, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5420"); // Verify MS-ASCMD requirement: MS-ASCMD_R5420 // If SmartReply command executes successful, the reply mail content contains the original mail content Site.CaptureRequirementIfIsTrue( replyMailContent.Contains(originalContent), 5420, @"[In Appendix A: Product Behavior] If SmartReply is applied to a recurring meeting and the InstanceId element is absent, the implementation does reply for the entire recurring meeting. (Exchange 2007 and above follow this behavior.)"); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R580"); // Verify MS-ASCMD requirement: MS-ASCMD_R580 Site.CaptureRequirementIfIsTrue( replyMailContent.Contains(originalContent), 580, @"[In SmartReply] The full text of the original message is retrieved and sent by the server."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R569"); // Verify MS-ASCMD requirement: MS-ASCMD_R569 Site.CaptureRequirementIfIsTrue( replyMailContent.Contains(originalContent), 569, @"[In SmartReply] The SmartReply command is used by clients to reply to messages without retrieving the full, original message from the server."); #endregion }