Esempio n. 1
0
        /// <summary>
        /// Reply to messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartReplyRequest">The request for SmartReply command.</param>
        /// <returns>The SmartReply response which is returned from server.</returns>
        public SmartReplyResponse SmartReply(SmartReplyRequest smartReplyRequest)
        {
            SmartReplyResponse response = this.activeSyncClient.SmartReply(smartReplyRequest);

            Site.Assert.IsNotNull(response, "If the command is successful, the response should not be null.");
            return(response);
        }
        /// <summary>
        /// Builds a SmartReply request by using the specified source folder Id, source server Id and reply mime information.
        /// </summary>
        /// <param name="sourceFolderId">Specify the folder id of original mail item being replied</param>
        /// <param name="sourceServerId">Specify the server Id of original mail item being replied</param>
        /// <param name="replyMime">The total reply mime</param>
        /// <returns>Returns the SmartReply request instance</returns>
        internal static SmartReplyRequest CreateSmartReplyRequest(string sourceFolderId, string sourceServerId, string replyMime)
        {
            SmartReplyRequest request = new SmartReplyRequest
            {
                RequestData = new Request.SmartReply
                {
                    ClientId = System.Guid.NewGuid().ToString(),
                    Source   = new Request.Source {
                        FolderId = sourceFolderId, ItemId = sourceServerId
                    },
                    Mime = replyMime
                }
            };

            request.SetCommandParameters(new Dictionary <CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, sourceFolderId
                },
                {
                    CmdParameterName.ItemId, sourceServerId
                }
            });
            return(request);
        }
        /// <summary>
        /// Reply to messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartReplyRequest">The request for SmartReply operation.</param>
        /// <returns>The SmartReply response which is returned from the server.</returns>
        public SmartReplyResponse SmartReply(SmartReplyRequest smartReplyRequest)
        {
            SmartReplyResponse response = this.activeSyncClient.SmartReply(smartReplyRequest);

            Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
            this.VerifyTransport();
            return(response);
        }
Esempio n. 4
0
        /// <summary>
        /// Replies to messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartReplyRequest">A SmartReplyRequest object that contains the request information.</param>
        /// <returns>SmartReply command response.</returns>
        public SmartReplyResponse SmartReply(SmartReplyRequest smartReplyRequest)
        {
            SmartReplyResponse smartReplyResponse = this.activeSyncClient.SmartReply(smartReplyRequest);

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

            return(smartReplyResponse);
        }
        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
        }
        /// <summary>
        /// Reply to messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="request">A SmartReplyRequest object that contains the request information.</param>
        /// <returns>SmartReply command response</returns>
        public SmartReplyResponse SmartReply(SmartReplyRequest request)
        {
            SmartReplyResponse response = this.activeSyncClient.SmartReply(request);

            this.VerifyTransportRequirements();
            this.VerifyWBXMLCapture(CommandName.SmartReply, response);
            this.VerifySmartReplyCommand(response);
            return(response);
        }
        /// <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_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
        }
        /// <summary>
        /// Call SmartReply command to reply 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="replyTo">The mailbox address of recipient.</param>
        /// <param name="subject">The subject of the email to reply.</param>
        protected void CallSmartReplyCommand(string itemServerId, string collectionId, string from, string replyTo, string subject)
        {
            // Create SmartReply command request.
            Request.Source    source            = new Request.Source();
            string            mime              = Common.CreatePlainTextMime(from, replyTo, string.Empty, string.Empty, subject, "SmartReply content");
            SmartReplyRequest smartReplyRequest = Common.CreateSmartReplyRequest(null, System.Guid.NewGuid().ToString(), mime, source);

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

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

            // Call SmartReply command.
            SmartReplyResponse smartReplyResponse = this.CONAdapter.SmartReply(smartReplyRequest);

            Site.Assert.AreEqual(string.Empty, smartReplyResponse.ResponseDataXML, "The SmartReply command should be executed successfully.");
        }
        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
        }
Esempio n. 11
0
 /// <summary>
 /// Create a SmartReplyRequest instance using specified information
 /// </summary>
 /// <param name="accountId">Specified the account Id</param>
 /// <param name="clientId">Specified the client Id</param>
 /// <param name="mime">Specified the mime</param>
 /// <param name="source">Specified the SmartReplySource</param>
 /// <returns>A SmartReplyRequest instance</returns>
 public static SmartReplyRequest CreateSmartReplyRequest(string accountId, string clientId, string mime, Request.Source source)
 {
     SmartReplyRequest request = new SmartReplyRequest();
     Request.SmartReply requestData = new Request.SmartReply
     {
         AccountId = accountId,
         ClientId = clientId,
         Mime = mime,
         Source = source
     };
     request.RequestData = requestData;
     return request;
 }
Esempio n. 12
0
 /// <summary>
 /// Create an empty SmartReplyRequest instance
 /// </summary>
 /// <returns>An empty SmartReplyRequest instance</returns>
 public static SmartReplyRequest CreateSmartReplyRequest()
 {
     SmartReplyRequest request = new SmartReplyRequest();
     Request.SmartReply requestData = new Request.SmartReply();
     request.RequestData = requestData;
     return request;
 }
        /// <summary>
        /// Builds a SmartReply request by using the specified source folder Id, source server Id and reply mime information.
        /// </summary>
        /// <param name="sourceFolderId">Specify the folder id of original mail item being replied</param>
        /// <param name="sourceServerId">Specify the server Id of original mail item being replied</param>
        /// <param name="replyMime">The total reply mime</param>
        /// <returns>Returns the SmartReply request instance</returns>
        internal static SmartReplyRequest CreateSmartReplyRequest(string sourceFolderId, string sourceServerId, string replyMime)
        {
            SmartReplyRequest request = new SmartReplyRequest
            {
                RequestData = new Request.SmartReply
                {
                    ClientId = System.Guid.NewGuid().ToString(),
                    Source = new Request.Source { FolderId = sourceFolderId, ItemId = sourceServerId },
                    Mime = replyMime
                }
            };

            request.SetCommandParameters(new Dictionary<CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, sourceFolderId
                },
                {
                    CmdParameterName.ItemId, sourceServerId
                }
            });
            return request;
        }
 /// <summary>
 /// Reply to messages without retrieving the full, original message from the server.
 /// </summary>
 /// <param name="smartReplyRequest">The request for SmartReply operation.</param>
 /// <returns>The SmartReply response which is returned from the server.</returns>
 public SmartReplyResponse SmartReply(SmartReplyRequest smartReplyRequest)
 {
     SmartReplyResponse response = this.activeSyncClient.SmartReply(smartReplyRequest);
     Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
     this.VerifyTransport();
     return response;
 }
        /// <summary>
        /// Create a SmartReply request.
        /// </summary>
        /// <param name="folderID">The value of the FolderID element</param>
        /// <param name="serverID">The value of the ServerId element.</param>
        /// <param name="from">The value of the From element.</param>
        /// <param name="to">The value of the To element.</param>
        /// <param name="cc">The value of the Cc element.</param>
        /// <param name="bcc">The value of the Bcc element.</param>
        /// <param name="subject">The value of the Subject element.</param>
        /// <param name="content">The value of the Content element.</param>
        /// <returns>the SmartReply request.</returns>
        protected static SmartReplyRequest CreateSmartReplyRequest(string folderID, string serverID, string from, string to, string cc, string bcc, string subject, string content)
        {
            SmartReplyRequest request = new SmartReplyRequest
            {
                RequestData = new Request.SmartReply
                {
                    ClientId = System.Guid.NewGuid().ToString(),
                    Source = new Request.Source { FolderId = folderID, ItemId = serverID },
                    Mime = Common.CreatePlainTextMime(@from, to, cc, bcc, subject, content)
                }
            };

            request.SetCommandParameters(new Dictionary<CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, folderID
                },
                {
                    CmdParameterName.ItemId, serverID
                }
            });

            return request;
        }
        /// <summary>
        /// Replies to messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartReplyRequest">A SmartReplyRequest object that contains the request information.</param>
        /// <returns>SmartReply command response.</returns>
        public SmartReplyResponse SmartReply(SmartReplyRequest smartReplyRequest)
        {
            SmartReplyResponse smartReplyResponse = this.activeSyncClient.SmartReply(smartReplyRequest);
            Site.Assert.IsNotNull(smartReplyResponse, "The SmartReply response returned from server should not be null.");

            return smartReplyResponse;
        }