Exemple #1
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.");
        }
Exemple #2
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.)");
        }
        /// <summary>
        /// Send a weekly meeting request.
        /// </summary>
        /// <param name="meetingRequestSubject">The subject of the meeting request.</param>
        /// <param name="recipientEmailAddress">The email address of the recipient.</param>
        protected void SendWeeklyRecurrenceMeetingRequest(string meetingRequestSubject, string recipientEmailAddress)
        {
            Calendar calendar = this.CreateCalendar(meetingRequestSubject, recipientEmailAddress, null);
            int offset = new Random().Next(1, 100000);

            calendar.DtStamp = DateTime.UtcNow.AddDays(offset);
            calendar.StartTime = DateTime.UtcNow.AddDays(offset);
            calendar.EndTime = DateTime.UtcNow.AddDays(offset).AddHours(2);

            // Set recurrence to weekly
            Response.Recurrence recurrence = new Response.Recurrence
            {
                Type = 1,
                Interval = 1,
                DayOfWeek = 2,
                DayOfWeekSpecified = true,
                Until = DateTime.UtcNow.AddDays(offset + 20).ToString("yyyyMMddTHHmmssZ")
            };

            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.1"))
            {
                recurrence.FirstDayOfWeek = 1;
                recurrence.FirstDayOfWeekSpecified = true;
            }

            calendar.Recurrence = recurrence;

            this.SendMeetingRequest(meetingRequestSubject, calendar);
        }