Ejemplo 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>
        /// 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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        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
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        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
        }
Ejemplo n.º 7
0
        /// <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.");
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This method is used to verify the SmartReply response related requirements.
        /// </summary>
        /// <param name="smartReplyResponse">SmartReply command response.</param>
        private void VerifySmartReplyCommand(SmartReplyResponse smartReplyResponse)
        {
            Site.Assert.IsTrue(this.activeSyncClient.ValidationResult, "The schema validation result should be true.");
            Site.Assert.IsNotNull(smartReplyResponse.ResponseData, "The SmartReply element should not be null.");

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

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

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

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

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

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

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

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

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

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

            this.VerifyContainerDataType();

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

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

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

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

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

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

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

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

                this.VerifyIntegerDataType();

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

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