Esempio n. 1
0
        public void MSASCMD_S10_TC05_MoveItems_Status4()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to Inbox folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.InboxCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4219
            Site.CaptureRequirementIfAreEqual <int>(
                4,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4219,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 4 is] The client supplied a destination folder that is the same as the source.");
            #endregion
        }
Esempio n. 2
0
        public void MSASCMD_S10_TC04_MoveItems_Status2()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to an invalid destination folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, "Invalid DstFldId");
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4212
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4212,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 2 is] The destination folder collection ID (CollectionId element value) is not recognized by the server, possibly because the source folder has been deleted.");
            #endregion
        }
        public void MSASCMD_S21_TC04_CommonStatusCode_105()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The DstFldId element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            #region User2 sends mail to User1 and do FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId          = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to recipient information cache.
            Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.RecipientInformationCacheCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            MoveItemsRequest  moveItemsRequest  = Common.CreateMoveItemsRequest(new Request.MoveItemsMove[] { moveItemsMove });
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4821
            Site.CaptureRequirementIfAreEqual <int>(
                105,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4821,
                @"[In Common Status Codes] [The meaning of the status value 105 is] The request contains a combination of parameters that is invalid.");
        }
Esempio n. 4
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.");
        }
Esempio n. 5
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.");
        }
        public void MSASCMD_S18_TC02_SmartReply_Success()
        {
            #region Call SendMail command to send one plain text email to user2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            #region Call Sync command to sync user2 mailbox changes
            this.SwitchUser(this.User2Information);
            SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject);
            string       originalServerId   = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject);
            #endregion

            #region Record user name, folder collectionId and item subject that are useed in this case
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call SmartReply command to reply to messages without retrieving the full, original message from the server
            string            smartReplySubject = string.Format("REPLY: {0}", emailSubject);
            SmartReplyRequest smartReplyRequest = this.CreateDefaultReplyRequest(smartReplySubject, originalServerId);

            SmartReplyResponse smartReplyResponse = this.CMDAdapter.SmartReply(smartReplyRequest);

            #endregion

            #region Call Sync command to sync user1 mailbox changes
            this.SwitchUser(this.User1Information);
            this.GetMailItem(this.User1Information.InboxCollectionId, smartReplySubject);
            #endregion

            #region Record user name, folder collectionId and item subject that are useed in this case
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, smartReplySubject);
            #endregion

            #region Verify Requirements MS-ASCMD_R605, MS-ASCMD_R5776
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R605");

            // Verify MS-ASCMD requirement: MS-ASCMD_R605
            // If the message was sent successfully, the server won't return any XML data, then MS-ASCMD_R605 is verified.
            Site.CaptureRequirementIfAreEqual <string>(
                string.Empty,
                smartReplyResponse.ResponseDataXML,
                605,
                @"[In SmartReply] If the message was sent successfully, the server returns an empty response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5776
            // If the message was sent successfully, the server won't return any XML data, then MS-ASCMD_R776 is verified.
            Site.CaptureRequirementIfAreEqual <string>(
                string.Empty,
                smartReplyResponse.ResponseDataXML,
                5776,
                @"[In Status(SmartForward and SmartReply)] If the [SmartForward command request or] SmartReply command request succeeds, no XML body is returned in the response.");
            #endregion
        }
        public void MSASCMD_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
        }
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.");
        }
Esempio n. 9
0
        public void MSASCMD_S10_TC07_MoveItems_Status103()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(5671, this.Site), "Exchange 2007 does not limit the number of elements in command requests.");

            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string syncKeyInbox = this.LastSyncKey;
            string serverId     = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server, and get the SyncKey
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            Request.MoveItemsMove moveItemsMove = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.DeletedItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            Request.MoveItems moveItems = new Request.MoveItems();
            moveItems.Move = new Request.MoveItemsMove[1001];
            for (int i = 0; i <= 1000; i++)
            {
                moveItems.Move[i] = moveItemsMove;
            }

            MoveItemsRequest  request     = new MoveItemsRequest();
            Request.MoveItems requestData = moveItems;
            request.RequestData = requestData;

            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(request);

            this.Site.CaptureRequirementIfAreEqual <int>(
                103,
                int.Parse(moveItemsResponse.ResponseData.Status),
                5653,
                @"[In Limiting Size of Command Requests] In MoveItems (section 2.2.2.11) command request, when the limit value of Move element is bigger than 1000 (minimum 1, maximum 2,147,483,647), the error returned by server is Status element (section 2.2.3.167.9) value of 103.");
            #endregion
        }
        public void MSASCMD_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. 13
0
        public void MSASCMD_S10_TC03_MoveItems_Status1_InvalidSrcMsgId()
        {
            #region User2 calls SendMail command to send a mail to User1.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region User1 calls Sync command to synchronize changes of Inbox folder and get the ServerId of sent email item and the latest SyncKey.
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string serverId = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region User1 calls MoveItems command with the received email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);
            #endregion

            #region User1 calls MoveItems command with the received email item's ServerId again to move the email item from Inbox folder to DeletedItems folder after the email item is not exist in Inbox folder.
            moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4208
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4208,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 1 is] Or, the item with the Item ID (SrcMsgId element (section 2.2.3.160)) has been previously moved out of the folder with the Folder ID (SrcFldId element (section 2.2.3.159)).");
            #endregion
        }
Esempio n. 14
0
        public void MSASCMD_S10_TC02_MoveItems_Status1_InvalidSrcFldId()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item
            SyncResponse syncResponse = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       serverId     = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from an invalid source folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, "Invalid SrcFldId", this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4201
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4201,
                @"[In Status(MoveItems)] If the command failed, Status contains a code indicating the type of failure.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4207
            Site.CaptureRequirementIfAreEqual <int>(
                1,
                int.Parse(moveItemsResponse.ResponseData.Response[0].Status),
                4207,
                @"[In Status(MoveItems)] [When the scope is Item], [the cause of the status value 1 is] The source folder collection ID (CollectionId element (section 2.2.3.30.5) value) is not recognized by the server, possibly because the source folder has been deleted.");
            #endregion
        }
        public void MSASCMD_S18_TC01_SmartReply_ContainOriginalMessage()
        {
            Site.Assume.AreNotEqual <string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The InstanceId element is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "Recurrences cannot be added in protocol version 16.0");

            #region User1 calls SendMail command to send one recurring meeting request to user2.
            string meetingRequestSubject = Common.GenerateResourceName(Site, "subject");
            string attendeeEmailAddress  = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            this.SendWeeklyRecurrenceMeetingRequest(meetingRequestSubject, attendeeEmailAddress);
            #endregion

            #region Call Sync command to sync user2 mailbox changes
            this.SwitchUser(this.User2Information);
            SyncResponse syncChangeResponse   = this.GetMailItem(this.User2Information.InboxCollectionId, meetingRequestSubject);
            SyncResponse syncCalendarResponse = this.GetMailItem(this.User2Information.CalendarCollectionId, meetingRequestSubject);
            string       calendarItemID       = TestSuiteBase.FindServerId(syncCalendarResponse, "Subject", meetingRequestSubject);

            // Get User2 original mail content
            string originalServerId = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", meetingRequestSubject);
            string originalContent  = TestSuiteBase.GetDataFromResponseBodyElement(syncChangeResponse, originalServerId);
            #endregion

            #region Record user name, folder collectionId and item subject that are useed in this case
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, meetingRequestSubject);
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.CalendarCollectionId, meetingRequestSubject);
            #endregion

            #region Call SmartReply command to reply to messages without instanceID in request
            string            smartReplySubject = string.Format("REPLY: {0}", meetingRequestSubject);
            SmartReplyRequest smartReplyRequest = this.CreateDefaultReplyRequest(smartReplySubject, calendarItemID);

            // Add elements to smartReplyRequest
            smartReplyRequest.RequestData.Source.InstanceId = null;
            smartReplyRequest.RequestData.Source.FolderId   = this.User2Information.CalendarCollectionId;
            smartReplyRequest.RequestData.Source.ItemId     = calendarItemID;
            this.CMDAdapter.SmartReply(smartReplyRequest);
            #endregion

            #region Call Sync command to sync user1 mailbox changes
            this.SwitchUser(this.User1Information);
            SyncResponse syncResponseOnUserOne = this.GetMailItem(this.User1Information.InboxCollectionId, smartReplySubject);

            // Get replied mail content
            string replyMailServerId = TestSuiteBase.FindServerId(syncResponseOnUserOne, "Subject", smartReplySubject);
            string replyMailContent  = TestSuiteBase.GetDataFromResponseBodyElement(syncResponseOnUserOne, replyMailServerId);
            #endregion

            #region Record user name, folder collectionId and item subject that are useed in this case
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, smartReplySubject);
            #endregion

            #region Verify Requirements MS-ASCMD_R5420, MS-ASCMD_R580, MS-ASCMD_R569

            if (Common.IsRequirementEnabled(5420, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5420");

                // Verify MS-ASCMD requirement: MS-ASCMD_R5420
                // If SmartReply command executes successful, the reply mail content contains the original mail content
                Site.CaptureRequirementIfIsTrue(
                    replyMailContent.Contains(originalContent),
                    5420,
                    @"[In Appendix A: Product Behavior] If SmartReply is applied to a recurring meeting and the InstanceId element is absent, the implementation does reply for the entire recurring meeting. (Exchange 2007 and above follow this behavior.)");
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R580
            Site.CaptureRequirementIfIsTrue(
                replyMailContent.Contains(originalContent),
                580,
                @"[In SmartReply] The full text of the original message is retrieved and sent by the server.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R569
            Site.CaptureRequirementIfIsTrue(
                replyMailContent.Contains(originalContent),
                569,
                @"[In SmartReply] The SmartReply command is used by clients to reply to messages without retrieving the full, original message from the server.");
            #endregion
        }
Esempio n. 16
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. 17
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. 18
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. 19
0
        public void MSASCMD_S10_TC01_MoveItems_Success()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server, and get the ServerId of sent email item and the SyncKey
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);
            string syncKeyInbox = this.LastSyncKey;
            string serverId     = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server, and get the SyncKey
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId to move the email item from Inbox folder to DeletedItems folder.
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(serverId, this.User1Information.InboxCollectionId, this.User1Information.DeletedItemsCollectionId);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 1);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4217
            Site.CaptureRequirementIfAreEqual <string>(
                "3",
                moveItemsResponse.ResponseData.Response[0].Status,
                4217,
                @"[In Status(MoveItems)] [When the scope is Global], [the cause of the status value 3 is] Server successfully completed command.");

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

            Site.CaptureRequirementIfAreEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].SrcMsgId,
                3977,
                "[In SrcMsgId] The SrcMsgId element is a required child element of the Response element in MoveItems command responses that specifies the server ID of the item that was moved.");

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

            Site.CaptureRequirementIfAreNotEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].DstMsgId,
                285,
                "[In MoveItems] The MoveItems command moves an item or items from one folder on the server to another [folder].");

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

            Site.CaptureRequirementIfAreNotEqual <string>(
                serverId,
                moveItemsResponse.ResponseData.Response[0].DstMsgId,
                290,
                "[In MoveItems] An item that has been successfully moved to a different folder can be assigned a new server ID by the server.");
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder and DeletedItems folder in User1's mailbox, and record the item changes for clean up
            bool isItemDeleted = this.CheckDeleteInSyncResponse(syncKeyInbox, this.User1Information.InboxCollectionId, serverId);
            Site.Assert.IsTrue(isItemDeleted, "The item with ServerId: {0} should be deleted for collection ID: {0}.", serverId, this.User1Information.InboxCollectionId);
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);

            bool isItemAdded = this.CheckAddInSyncResponse(syncKeyDeletedItems, this.User1Information.DeletedItemsCollectionId, subject);

            Site.Assert.IsTrue(isItemAdded, "The item with ServerId: {0} should be added for Deleted Items folder", serverId);
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R289
            // This requirement can be captured directly after previous step when synchronize changes of Inbox folder, there is a Delete operation,
            // and synchronize changes of DeletedItems folder, there is an Add operation.
            Site.CaptureRequirement(
                289,
                @"[In MoveItems] When items are moved between folders on the server, the client receives Delete (section 2.2.3.42) and Add (section 2.2.3.7) operations the next time the client synchronizes the affected folders.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5879
            // This requirement can be captured directly after previous step when synchronize changes of Inbox folder, there is a Delete operation on the source item
            // and synchronize changes of DeletedItems folder, there is an Add operation on the item with same subject.
            Site.CaptureRequirement(
                5879,
                @"[In SrcFldId] [The SrcFldId element] specifies the server ID of the source folder (that is, the folder that contains the items to be moved).");
            #endregion
        }
        public void MSASCMD_S06_TC02_GetAttachment_Status500()
        {
            Site.Assume.AreNotEqual <string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("14.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 14.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual <string>("16.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The GetAttachment command is not supported when the MS-ASProtocolVersion header is set to 16.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");

            // Send a mail with normal attachment
            string subject = Common.GenerateResourceName(Site, "NormalAttachment_Subject");
            string body    = Common.GenerateResourceName(Site, "NormalAttachment_Body");

            this.SendEmailWithAttachment(subject, body);

            this.SwitchUser(this.User2Information);
            SyncResponse syncResponse = this.CheckEmail(this.User2Information.InboxCollectionId, subject, null);

            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, subject);

            Response.AttachmentsAttachment[] attachments = this.GetEmailAttachments(syncResponse, subject);
            Site.Assert.IsTrue(attachments != null && attachments.Length == 1, "The email should contain a single attachment.");

            GetAttachmentRequest getAttachmentRequest = new GetAttachmentRequest();

            getAttachmentRequest.SetCommandParameters(new Dictionary <CmdParameterName, object>
            {
                {
                    CmdParameterName.AttachmentName, attachments[0].FileReference
                }
            });

            GetAttachmentResponse getAttachmentResponse = this.CMDAdapter.GetAttachment(getAttachmentRequest);

            Site.Assert.AreEqual <string>("OK", getAttachmentResponse.StatusDescription, "The attachment should be retrieved successfully.");

            // Delete the email in the Inbox folder.
            syncResponse = this.SyncChanges(this.User2Information.InboxCollectionId);

            string      serverId    = TestSuiteBase.FindServerId(syncResponse, "Subject", subject);
            SyncRequest syncRequest = TestSuiteBase.CreateSyncDeleteRequest(this.LastSyncKey, this.User2Information.InboxCollectionId, serverId);

            this.Sync(syncRequest);

            syncRequest.RequestData.Collections[0].SyncKey = this.LastSyncKey;
            syncResponse = this.Sync(syncRequest);
            Site.Assert.IsNull(TestSuiteBase.FindServerId(syncResponse, "Subject", subject), "The email should be deleted.");
            TestSuiteBase.RemoveRecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, subject);

            syncResponse = this.SyncChanges(this.User2Information.DeletedItemsCollectionId);
            Site.Assert.IsNotNull(TestSuiteBase.FindServerId(syncResponse, "Subject", subject), "The deleted email should be in the DeletedItems folder.");
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.DeletedItemsCollectionId, subject);

            try
            {
                // Call GetAttachment command again to fetch the deleted attachment.
                this.CMDAdapter.GetAttachment(getAttachmentRequest);
                Site.Assert.Fail("If the GetAttachment command is used to retrieve an attachment that has been deleted on the server, a 500 status code should be returned in the HTTP POST response.");
            }
            catch (System.Net.WebException exception)
            {
                int statusCode = ((System.Net.HttpWebResponse)exception.Response).StatusCode.GetHashCode();

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

                // Verify MS-ASCMD requirement: MS-ASCMD_R166
                Site.CaptureRequirementIfAreEqual <int>(
                    500,
                    statusCode,
                    166,
                    @"[In GetAttachment] If the GetAttachment command is used to retrieve an attachment that has been deleted on the server, a 500 status code is returned in the HTTP POST response.");
            }
        }
Esempio n. 21
0
        public void MSASCMD_S11_TC06_Ping_ChangesOccurred()
        {
            #region User2 calls CreateFolder command to create two sub folders in user Inbox folder
            this.SwitchUser(this.User2Information);
            int           folderCreateCount = 2;
            List <string> folderIDList      = new List <string>();
            for (int folderIndex = 0; folderIndex < folderCreateCount; folderIndex++)
            {
                string folderID = this.CreateFolder((byte)FolderType.UserCreatedMail, Common.GenerateResourceName(Site, "FolderCreate", (uint)(folderIndex + 1)), this.User2Information.InboxCollectionId);
                folderIDList.Add(folderID);

                // Sync the new created folder
                this.SyncChanges(folderID);
            }

            // Record created folders
            TestSuiteBase.RecordCaseRelativeFolders(this.User2Information, folderIDList.ToArray());
            #endregion

            #region User1 calls SendMail command to send one mail to user2, then user2 move the email to one of new created folder
            this.SwitchUser(this.User1Information);
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);

            // User2 calls Sync command to get the email, then moves to sub folder
            this.SwitchUser(this.User2Information);
            SyncResponse syncInboxFolderResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject);
            string       emailItemServerID       = TestSuiteBase.FindServerId(syncInboxFolderResponse, "Subject", emailSubject);

            // User2 calls MoveItems command to move the email item from Inbox folder to one of created subfolder
            MoveItemsRequest  moveItemsRequest  = TestSuiteBase.CreateMoveItemsRequest(emailItemServerID, this.User2Information.InboxCollectionId, folderIDList[0]);
            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);
            Site.Assert.AreEqual(3, Convert.ToInt32(moveItemsResponse.ResponseData.Response[0].Status), " If MoveItems command executes successfully, server should return status 3");
            #endregion

            #region Resend ping request to monitor the changes in sub folders and record duration
            DateTime     startTime    = DateTime.Now;
            PingRequest  pingRequest  = CreateMultiFolderPingRequest(folderIDList, Request.PingFolderClass.Email);
            PingResponse pingResponse = this.CMDAdapter.Ping(pingRequest);
            DateTime     endTime      = DateTime.Now;
            TimeSpan     duration     = endTime - startTime;
            #endregion

            #region Verify Requirements MS-ASCMD_R306, MS-ASCMD_R4235, MS-ASCMD_R4236, MS-ASCMD_R5714, MS-ASCMD_R5636
            // Ping command is used to monitor specified folder changes, if changes happened in the folders, server will return status 2 in Ping response, then MS-ASCMD_R306, MS-ASCMD_R4235, MS-ASCMD_R4236, MS-ASCMD_R5636 are verified.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R306");

            // Verify MS-ASCMD requirement: MS-ASCMD_R306
            Site.CaptureRequirementIfIsNotNull(
                pingResponse.ResponseData.Status,
                306,
                @"[In Ping] The Ping command is used to request that the server monitor specified folders for changes that would require the client to resynchronize.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4235
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                4235,
                @"[In Status(Ping)] [When the scope is] Global, [the meaning of the status value] 2 [is] Changes occurred in at least one of the monitored folders.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5636
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                5636,
                @"[In Monitoring Folders for New Items] The server uses the last airsync:SyncKey element (as specified in section 2.2.3.166.4) value returned to the client when determining what to report in the Ping response.");

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4236
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                4236,
                @"[In Status(Ping)] [When the scope is] Global, [the meaning of the status value 2 is] The response specifies the changed folders.");

            if (Common.IsRequirementEnabled(5714, this.Site))
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R5714");

                // Verify MS-ASCMD requirement: MS-ASCMD_R5714
                Site.CaptureRequirementIfIsTrue(
                    pingRequest.RequestData.HeartbeatInterval != null && int.Parse(pingResponse.ResponseData.Status) == 2 && duration.Milliseconds < Convert.ToInt32(pingRequest.RequestData.HeartbeatInterval) * 1000,
                    5714,
                    @"[In Appendix A: Product Behavior] The body of the request contains an interval of time that specifies how long the implementation does wait before responding if no new items are added to the specified folders. (Exchange 2007 and above follow this behavior.)");
            }
            #endregion

            #region Send ping request with empty HeartbeatInterval element, if server returns status equal to 2 then MS-ASCMD_R5836 is verified.
            pingRequest = CreateMultiFolderPingRequest(folderIDList, Request.PingFolderClass.Email);
            pingRequest.RequestData.HeartbeatInterval = null;
            pingResponse = this.CMDAdapter.Ping(pingRequest);
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R5836
            Site.CaptureRequirementIfAreEqual <int>(
                2,
                int.Parse(pingResponse.ResponseData.Status),
                5836,
                @"[In Status(Ping)] [When the scope is Global], The server saves the heartbeat interval value (section 2.2.3.79.1), so only the folder list is required on subsequent requests.");
        }
Esempio n. 22
0
        public void MSASCMD_S10_TC06_MoveItems_Status5()
        {
            #region User2 sends mail to User1 and does FolderSync in User1's mailbox.
            string subject = this.SendMailAndFolderSync();
            #endregion

            #region Call method Sync to synchronize changes of Inbox folder in User1's mailbox between the client and the server.
            SyncResponse syncResponseInbox = this.GetMailItem(this.User1Information.InboxCollectionId, subject);
            string       syncKeyInbox      = this.LastSyncKey;
            string       serverId          = TestSuiteBase.FindServerId(syncResponseInbox, "Subject", subject);
            #endregion

            #region Call method Sync to synchronize changes of DeletedItems folder in User1's mailbox between the client and the server.
            this.SyncChanges(this.User1Information.DeletedItemsCollectionId);
            string syncKeyDeletedItems = this.LastSyncKey;
            #endregion

            #region Call method Sync to synchronize changes of SentItems folder in User1's mailbox between the client and the server.
            this.SyncChanges(this.User1Information.SentItemsCollectionId);
            string syncKeySentItems = this.LastSyncKey;
            #endregion

            #region Call method MoveItems with the email item's ServerId and two different destination collection IDs to move the same email item from Inbox folder to two different folders, and check if there is one response with Status element equal to 5
            MoveItemsRequest             moveItemsRequest = new MoveItemsRequest();
            Request.MoveItems            moveItems        = new Request.MoveItems();
            List <Request.MoveItemsMove> moveItemList     = new List <Request.MoveItemsMove>();

            Request.MoveItemsMove moveItemsMoveOne = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.DeletedItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };
            moveItemList.Add(moveItemsMoveOne);

            Request.MoveItemsMove moveItemsMoveTwo = new Request.MoveItemsMove
            {
                DstFldId = this.User1Information.SentItemsCollectionId,
                SrcFldId = this.User1Information.InboxCollectionId,
                SrcMsgId = serverId
            };

            moveItemList.Add(moveItemsMoveTwo);

            moveItems.Move = moveItemList.ToArray();

            moveItemsRequest.RequestData = moveItems;

            MoveItemsResponse moveItemsResponse = this.CMDAdapter.MoveItems(moveItemsRequest);

            this.CheckMoveItemsResponse(moveItemsResponse, 2);

            bool hasStatus5 = false;
            bool hasStatus3 = false;
            foreach (Response.MoveItemsResponse response in moveItemsResponse.ResponseData.Response)
            {
                if (int.Parse(response.Status) == 5)
                {
                    hasStatus5 = true;
                    Site.Log.Add(LogEntryKind.Debug, "There should be at least one Status element equal to 5 in MoveItems response");
                }
                else if (int.Parse(response.Status) == 3)
                {
                    hasStatus3 = true;
                }
            }

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R4222
            Site.CaptureRequirementIfIsTrue(
                hasStatus5,
                4222,
                @"[In Status(MoveItems)] [When the scope is Global], [the cause of the status value 5 is] More than one DstFldId element (section 2.2.3.47.2) was included in the request [or an item with that name already exists].");

            #endregion

            #region Call method Sync to synchronize changes of Inbox folder, DeletedItems and SentItems folder in User1's mailbox, and record the item changes in case there is another success response.
            if (hasStatus3)
            {
                bool isItemDeleted = this.CheckDeleteInSyncResponse(syncKeyInbox, this.User1Information.InboxCollectionId, serverId);
                Site.Assert.IsTrue(isItemDeleted, "The item with ServerId: {0} should be deleted for collection ID: {1}.", serverId, this.User1Information.InboxCollectionId);
                TestSuiteBase.RemoveRecordCaseRelativeItems(this.User1Information, this.User1Information.InboxCollectionId, subject);

                bool isItemAddedDeleteItems = this.CheckAddInSyncResponse(syncKeyDeletedItems, this.User1Information.DeletedItemsCollectionId, subject);
                if (isItemAddedDeleteItems)
                {
                    Site.Log.Add(LogEntryKind.Debug, "The item with ServerId: {0} has been added for Deleted Items folder", serverId);
                    TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.DeletedItemsCollectionId, subject);
                }

                bool isItemAddedSentItems = this.CheckAddInSyncResponse(syncKeySentItems, this.User1Information.SentItemsCollectionId, subject);
                if (isItemAddedSentItems)
                {
                    Site.Log.Add(LogEntryKind.Debug, "The item with ServerId: {0} has been added for Sent Items folder", serverId);
                    TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.SentItemsCollectionId, subject);
                }

                Site.Assert.AreNotEqual <bool>(
                    isItemAddedDeleteItems,
                    isItemAddedSentItems,
                    "If the source item is moved successfully, it should exist in either Deleted Items folder or Sent Items folder, but should not exist in both of these folders.");
            }
            #endregion
        }