Exemplo n.º 1
0
        public void MSASCMD_S17_TC03_SmartForwardAppointment()
        {
            #region User1 calls Sync command uploading one calendar item to create one appointment
            string   meetingRequestSubject = Common.GenerateResourceName(Site, "subject");
            Calendar calendar = new Calendar
            {
                OrganizerEmail = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain),
                OrganizerName  = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain),
                UID            = Guid.NewGuid().ToString(),
                Subject        = meetingRequestSubject
            };

            this.SyncAddCalendar(calendar);

            // Calls Sync command to sync user1's calendar folder
            SyncResponse syncUser1CalendarFolder = this.GetMailItem(this.User1Information.CalendarCollectionId, meetingRequestSubject);
            string       calendarItemId          = TestSuiteBase.FindServerId(syncUser1CalendarFolder, "Subject", meetingRequestSubject);

            // Record items need to be cleaned up.
            TestSuiteBase.RecordCaseRelativeItems(this.User1Information, this.User1Information.CalendarCollectionId, meetingRequestSubject);
            #endregion

            #region User1 calls smartForward command to forward mail to user2
            string forwardFromUser = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);
            string forwardToUser   = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            string forwardSubject  = string.Format("FW:{0}", meetingRequestSubject);
            string forwardContent  = Common.GenerateResourceName(Site, "forward:Appointment body");
            SmartForwardRequest  smartForwardRequest  = this.CreateSmartForwardRequest(this.User1Information.CalendarCollectionId, calendarItemId, forwardFromUser, forwardToUser, string.Empty, string.Empty, forwardSubject, forwardContent);
            SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest);
            Site.Assert.AreEqual(string.Empty, smartForwardResponse.ResponseDataXML, "If SmartForward command executes successfully, server should return empty xml data");
            #endregion

            #region User2 calls Sync command to get the forward mail sent by user1
            this.SwitchUser(this.User2Information);
            SyncResponse user2MailboxChange = this.GetMailItem(this.User2Information.InboxCollectionId, forwardSubject);

            // Record items need to be cleaned up.
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, forwardSubject);
            string mailItemServerId = TestSuiteBase.FindServerId(user2MailboxChange, "Subject", forwardSubject);

            Response.Attachments attachments = (Response.Attachments)TestSuiteBase.GetElementValueFromSyncResponse(user2MailboxChange, mailItemServerId, Response.ItemsChoiceType8.Attachments);
            Site.Assert.AreEqual <int>(1, attachments.Items.Length, "Server should return one attachment, if SmartForward one appointment executes successfully.");
            #endregion

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

            // Verify MS-ASCMD requirement: MS-ASCMD_R542
            Site.CaptureRequirementIfIsTrue(
                attachments.Items.Length == 1 && ((Response.AttachmentsAttachment)attachments.Items[0]).DisplayName.Contains(".eml"),
                542,
                @"[In SmartForward] When the SmartForward command is used for an appointment, the original message is included by the server as an attachment to the outgoing message.");
        }
        public void MSASCMD_S17_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
        }