/// <summary>
        /// Forward messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="request">A SmartForwardRequest object that contains the request information.</param>
        /// <returns>A SmartForwardResponse object.</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest request)
        {
            SmartForwardResponse response = this.activeSyncClient.SmartForward(request);

            Site.Assert.IsNotNull(response, "If the SmartForward command executes successfully, the response from server should not be null.");
            return(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Forwards messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartForwardRequest">The request for SmartForward command.</param>
        /// <returns>The SmartForward response which is returned from server.</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest smartForwardRequest)
        {
            SmartForwardResponse response = this.activeSyncClient.SmartForward(smartForwardRequest);

            Site.Assert.IsNotNull(response, "If the command is successful, the response should not be null.");
            return(response);
        }
Esempio n. 3
0
        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.");
        }
        /// <summary>
        /// Forwards messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartForwardRequest">The request for SmartForward operation.</param>
        /// <returns>The SmartForward response which is returned from the server.</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest smartForwardRequest)
        {
            SmartForwardResponse response = this.activeSyncClient.SmartForward(smartForwardRequest);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
            this.VerifyTransport();
            return(response);
        }
Esempio n. 5
0
        /// <summary>
        /// Forwards messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartForwardRequest">A SmartForwardRequest object that contains the request information.</param>
        /// <returns>SmartForward command response.</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest smartForwardRequest)
        {
            SmartForwardResponse smartForwardResponse = this.activeSyncClient.SmartForward(smartForwardRequest);

            Site.Assert.IsNotNull(smartForwardResponse, "The SmartForward response returned from server should not be null.");

            return(smartForwardResponse);
        }
Esempio n. 6
0
        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.");
        }
        /// <summary>
        /// Forwards messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="request">A SmartForwardRequest object that contains the request information.</param>
        /// <returns>SmartForward command response</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest request)
        {
            SmartForwardResponse response = this.activeSyncClient.SmartForward(request);

            this.VerifyTransportRequirements();
            this.VerifyWBXMLCapture(CommandName.SmartForward, response);
            this.VerifySmartForwardCommand(response);
            return(response);
        }
Esempio n. 8
0
        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_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_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.");
        }
Esempio n. 12
0
        /// <summary>
        /// Call SmartForward command to forward an email.
        /// </summary>
        /// <param name="itemServerId">The ServerId of the email to reply.</param>
        /// <param name="collectionId">The folder collectionId of the source email.</param>
        /// <param name="from">The mailbox address of sender.</param>
        /// <param name="forwardTo">The mailbox address of recipient.</param>
        /// <param name="subject">The subject of the email to reply.</param>
        protected void CallSmartForwardCommand(string itemServerId, string collectionId, string from, string forwardTo, string subject)
        {
            // Create SmartForward command request.
            Request.Source      source = new Request.Source();
            string              mime   = Common.CreatePlainTextMime(from, forwardTo, string.Empty, string.Empty, subject, "SmartForward content");
            SmartForwardRequest smartForwardRequest = Common.CreateSmartForwardRequest(null, System.Guid.NewGuid().ToString(), mime, source);

            // Set the command parameters.
            smartForwardRequest.SetCommandParameters(new Dictionary <CmdParameterName, object>());

            source.FolderId = collectionId;
            source.ItemId   = itemServerId;
            smartForwardRequest.CommandParameters.Add(CmdParameterName.CollectionId, collectionId);
            smartForwardRequest.CommandParameters.Add(CmdParameterName.ItemId, itemServerId);
            smartForwardRequest.RequestData.ReplaceMime = string.Empty;

            // Call SmartForward command.
            SmartForwardResponse smartForwardResponse = this.CONAdapter.SmartForward(smartForwardRequest);

            Site.Assert.AreEqual(string.Empty, smartForwardResponse.ResponseDataXML, "The SmartForward command should be executed successfully.");
        }
Esempio n. 13
0
        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
        }
Esempio n. 14
0
        public void MSASCMD_S17_TC06_SmartForwardRecurringMeetingWithoutInstanceId()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5834, this.Site), "[In Appendix A: Product Behavior] If SmartForward is applied to a recurring meeting and the InstanceId element is absent, the implementation does forward the entire recurring meeting. (Exchange 2007 and above follow this behavior.)");
            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 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);
            Response.Recurrence recurrence           = (Response.Recurrence)TestSuiteBase.GetElementValueFromSyncResponse(syncCalendarResponse, calendarItemID, Response.ItemsChoiceType8.Recurrence);
            Site.Assert.IsNotNull(recurrence, "If user2 received recurring meeting request, the calendar item should contain recurrence element");

            // Record relative items for clean up
            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 without InstanceId element 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);

            smartForwardRequest.RequestData.Source.InstanceId = null;
            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 After user2 forwards 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);

            // Sync user3 Calendar folder
            SyncResponse        syncUser3CalendarFolder = this.GetMailItem(this.User3Information.CalendarCollectionId, forwardSubject);
            string              user3CalendarItemID     = TestSuiteBase.FindServerId(syncUser3CalendarFolder, "Subject", forwardSubject);
            Response.Recurrence user3CalendarRecurrence = (Response.Recurrence)TestSuiteBase.GetElementValueFromSyncResponse(syncUser3CalendarFolder, user3CalendarItemID, Response.ItemsChoiceType8.Recurrence);

            // Record email items for clean up
            TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User2Information.InboxCollectionId, forwardSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User2Information.CalendarCollectionId, forwardSubject);
            #endregion

            #region Check the meeting forward notification mail which is sent from server to User1.
            this.SwitchUser(this.User1Information);
            string notificationSubject = "Meeting Forward Notification: " + forwardSubject;
            this.CheckMeetingForwardNotification(this.User1Information, notificationSubject);
            #endregion

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5834");

            // Verify MS-ASCMD requirement: MS-ASCMD_R5834
            // If the calendar item with specified subject contains Recurrence element, which indicates user3 received the entire meeting request.
            Site.CaptureRequirementIfIsTrue(
                user3CalendarRecurrence != null && forwardItemServerID != null,
                5834,
                @"[In Appendix A: Product Behavior] If SmartForward is applied to a recurring meeting and the InstanceId element is absent, the implementation does forward the entire recurring meeting. (Exchange 2007 and above follow this behavior.)");
        }
Esempio n. 15
0
        public void MSASCMD_S17_TC05_SmartForwardWithInstanceIdSuccess()
        {
            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 User2 calls Sync command to sync user2 mailbox changes
            this.SwitchUser(this.User2Information);
            SyncResponse syncMeetingMailResponse = this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject);

            // Record relative items for clean up.
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject);
            #endregion

            #region User2 calls MeetingResponse command to accept the meeting
            string serverIDForMeetingRequest = TestSuiteBase.FindServerId(syncMeetingMailResponse, "Subject", meetingRequestSubject);
            MeetingResponseRequest meetingResponseRequest = TestSuiteBase.CreateMeetingResponseRequest(1, this.User2Information.InboxCollectionId, serverIDForMeetingRequest, string.Empty);

            // If the user accepts the meeting request, the meeting request mail will be deleted and calendar item will be created.
            MeetingResponseResponse meetingResponseResponse = this.CMDAdapter.MeetingResponse(meetingResponseRequest);
            Site.Assert.IsNotNull(meetingResponseResponse.ResponseData.Result[0].CalendarId, "If the meeting was accepted, server should return calendarId in response");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject);
            this.GetMailItem(this.User2Information.DeletedItemsCollectionId, meetingRequestSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.DeletedItemsCollectionId, meetingRequestSubject);
            #endregion

            #region User2 calls Sync command to sync user calendar changes
            SyncResponse        syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject);
            string              calendarItemID       = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject);
            string              startTime            = (string)TestSuiteBase.GetElementValueFromSyncResponse(syncCalendarResponse, calendarItemID, Response.ItemsChoiceType8.StartTime);
            Response.Recurrence recurrence           = (Response.Recurrence)TestSuiteBase.GetElementValueFromSyncResponse(syncCalendarResponse, calendarItemID, Response.ItemsChoiceType8.Recurrence);
            Site.Assert.IsNotNull(recurrence, "If user2 received recurring meeting request, the calendar item should contain recurrence element");

            // Record relative items for clean up.
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject);
            #endregion

            #region User2 calls SmartForward command to forward the calendar item to user3 with correct 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 the same as required format "2010-03-20T22:40:00.000Z".
            string instanceID = ConvertInstanceIdFormat(startTime);
            smartForwardRequest.RequestData.Source.InstanceId = instanceID;
            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 After user2 forwards 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);

            // Sync user3 Calendar folder
            SyncResponse syncUser3CalendarFolder = this.GetMailItem(this.User3Information.CalendarCollectionId, forwardSubject);
            string       user3CalendarItemID     = TestSuiteBase.FindServerId(syncUser3CalendarFolder, "Subject", forwardSubject);

            // Record email items for clean up
            TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User3Information.InboxCollectionId, forwardSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User3Information, this.User3Information.CalendarCollectionId, forwardSubject);
            #endregion

            #region Record the meeting forward notification mail which sent from server to User1.
            this.SwitchUser(this.User1Information);
            string notificationSubject = "Meeting Forward Notification: " + forwardSubject;
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, notificationSubject);
            this.GetMailItem(this.User1Information.DeletedItemsCollectionId, notificationSubject);
            #endregion

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R538");

            // Verify MS-ASCMD requirement: MS-ASCMD_R538
            // If the calendar item with specified subject exists in user3 Calendar folder and email item exists in user3 Inbox folder which means user3 gets the forwarded mail.
            Site.CaptureRequirementIfIsTrue(
                user3CalendarItemID != null && forwardItemServerID != null,
                538,
                @"[In SmartForward] When SmartForward is applied to a recurring meeting, the InstanceId element (section 2.2.3.83.2) specifies the ID of a particular occurrence in the recurring meeting.");
        }
Esempio n. 16
0
        /// <summary>
        /// This method is used to verify the SmartForward response related requirements.
        /// </summary>
        /// <param name="smartForwardResponse">SmartForward command response.</param>
        private void VerifySmartForwardCommand(SmartForwardResponse smartForwardResponse)
        {
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "The schema validation result should be true.");
            Site.Assert.IsNotNull(smartForwardResponse.ResponseData, "The SmartForward element should not be null.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3957");

            // If the schema validation result is true and SmartForward is not null, this requirement can be verified.
            Site.CaptureRequirement(
                3957,
                @"[In SmartForward] The SmartForward element is a required element in SmartForward command requests and responses that identifies the body of the HTTP POST as containing a SmartForward command (section 2.2.2.18).");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2639");

            // If the schema validation result is true and SmartForward is not null, this requirement can be verified.
            Site.CaptureRequirement(
                2639,
                @"[In SmartForward]None [Element SmartForward in SmartForward command response has no parent element.]");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2640");

            // If the schema validation result is true and SmartForward is not null, this requirement can be verified.
            Site.CaptureRequirement(
                2640,
                @"[In SmartForward] Element SmartForward in SmartForward command response, the child eleemnt is Status (section 2.2.3.167.15).");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2641");

            // If the schema validation result is true and SmartForward is not null, this requirement can be verified.
            Site.CaptureRequirement(
                2641,
                @"[In SmartForward] Element SmartForward in SmartForward command response, the data type is container.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2642");

            // If the schema validation result is true and SmartForward is not null, this requirement can be verified.
            Site.CaptureRequirement(
                2642,
                @"[In SmartForward] Element SmartForward in SmartForward command response, the number allowed is 1...1 (required).");

            this.VerifyContainerDataType();

            if (smartForwardResponse.ResponseData.Status != null)
            {
                int status;

                Site.Assert.IsTrue(int.TryParse(smartForwardResponse.ResponseData.Status, out status), "The status element in SmartForward response should be an integer.");

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2759");

                // If the schema validation result is true and Status is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2759,
                    @"[In Status(SmartForward and SmartReply)] Element Status in SmartForward command response, the parent  element is SmartForward (section 2.2.3.159).");

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2760");

                // If the schema validation result is true and Status is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2760,
                    @"[In Status(SmartForward and SmartReply)] None [Element Status in SmartForward command response has no child element.]");

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2761");

                // If the schema validation result is true, Status(SmartForward and SmartReply) is an integer, this requirement can be verified.
                Site.CaptureRequirement(
                    2761,
                    @"[In Status(SmartForward and SmartReply)] Element Status in SmartForward command response, the data type is integer ([MS-ASDTYPE] section 2.6).");

                this.VerifyIntegerDataType();

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2762");

                // If the schema validation result is true and Status is not null, this requirement can be verified.
                Site.CaptureRequirement(
                    2762,
                    @"[In Status(SmartForward and SmartReply)] Element Status in SmartForward command response, the number allowed is 0...1 (optional).");
            }
        }