コード例 #1
0
        private RecurrencePattern ConvertRecurrencePattern(RecurrencePatternBaseType pattern)
        {
            DailyRecurrencePatternType dailyRecurrencePatternType = pattern as DailyRecurrencePatternType;

            if (dailyRecurrencePatternType != null)
            {
                return(new DailyRecurrencePattern(dailyRecurrencePatternType.Interval));
            }
            AbsoluteMonthlyRecurrencePatternType absoluteMonthlyRecurrencePatternType = pattern as AbsoluteMonthlyRecurrencePatternType;

            if (absoluteMonthlyRecurrencePatternType != null)
            {
                return(new MonthlyRecurrencePattern(absoluteMonthlyRecurrencePatternType.DayOfMonth, absoluteMonthlyRecurrencePatternType.Interval));
            }
            RelativeMonthlyRecurrencePatternType relativeMonthlyRecurrencePatternType = pattern as RelativeMonthlyRecurrencePatternType;

            if (relativeMonthlyRecurrencePatternType != null)
            {
                return(new MonthlyThRecurrencePattern(this.ConvertDaysOfWeek(relativeMonthlyRecurrencePatternType.DaysOfWeek), this.Convert(relativeMonthlyRecurrencePatternType.DayOfWeekIndex), relativeMonthlyRecurrencePatternType.Interval));
            }
            RelativeYearlyRecurrencePatternType relativeYearlyRecurrencePatternType = pattern as RelativeYearlyRecurrencePatternType;

            if (relativeYearlyRecurrencePatternType != null)
            {
                return(new YearlyThRecurrencePattern(this.ConvertDaysOfWeek(relativeYearlyRecurrencePatternType.DaysOfWeek), this.Convert(relativeYearlyRecurrencePatternType.DayOfWeekIndex), this.ConvertMonth(relativeYearlyRecurrencePatternType.Month)));
            }
            WeeklyRecurrencePatternType weeklyRecurrencePatternType = pattern as WeeklyRecurrencePatternType;

            if (weeklyRecurrencePatternType != null)
            {
                return(new WeeklyRecurrencePattern(this.ConvertDaysOfWeek(weeklyRecurrencePatternType.DaysOfWeek), weeklyRecurrencePatternType.Interval));
            }
            AbsoluteYearlyRecurrencePatternType absoluteYearlyRecurrencePatternType = pattern as AbsoluteYearlyRecurrencePatternType;

            if (absoluteYearlyRecurrencePatternType != null)
            {
                return(new YearlyRecurrencePattern(absoluteYearlyRecurrencePatternType.DayOfMonth, this.ConvertMonth(absoluteYearlyRecurrencePatternType.Month)));
            }
            AppointmentTranslator.Tracer.TraceError <AppointmentTranslator, RecurrencePatternBaseType>((long)this.GetHashCode(), "{0}: Unknown recurrence pattern: {1}", this, pattern);
            throw new InvalidAppointmentException();
        }
        /// <summary>
        /// Define the configuration of a recurring meeting.
        /// </summary>
        /// <param name="basePattern">A recurrence pattern.</param>
        /// <param name="range">A recurrence range.</param>
        /// <returns>A calendar item to be created.</returns>
        private CalendarItemType DefineRecurringMeeting(RecurrencePatternBaseType basePattern, RecurrenceRangeBaseType range)
        {
            CalendarItemType meetingItem = null;
            if (basePattern != null && range != null)
            {
                meetingItem = new CalendarItemType();

                // Define common property.
                meetingItem.UID = Guid.NewGuid().ToString();
                meetingItem.Subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("MeetingSubject", this.Site));
                meetingItem.Location = this.Location;
                meetingItem.IsResponseRequested = false;
                meetingItem.IsResponseRequestedSpecified = true;
                meetingItem.ConferenceType = 1;
                meetingItem.ConferenceTypeSpecified = true;
                meetingItem.AllowNewTimeProposal = true;
                meetingItem.AllowNewTimeProposalSpecified = true;
                meetingItem.LegacyFreeBusyStatus = LegacyFreeBusyType.OOF;
                meetingItem.LegacyFreeBusyStatusSpecified = true;

                DateTime startTime = DateTime.UtcNow.AddHours(3);
                meetingItem.Start = startTime;
                meetingItem.StartSpecified = true;

                DateTime endTime = startTime.AddHours(1);
                meetingItem.End = endTime;
                meetingItem.EndSpecified = true;

                // Set recurrence with specified pattern and range values.
                RecurrenceType recurrence = new RecurrenceType();
                AbsoluteYearlyRecurrencePatternType patternAbsoluteYearlyRecurrence = null;

                IntervalRecurrencePatternBaseType patternIntervalRecurrence = basePattern as IntervalRecurrencePatternBaseType;
                if (patternIntervalRecurrence != null)
                {
                    // Set the pattern's Interval.
                    patternIntervalRecurrence.Interval = this.PatternInterval;
                    recurrence.Item = patternIntervalRecurrence;
                }
                else
                {
                    patternAbsoluteYearlyRecurrence = basePattern as AbsoluteYearlyRecurrencePatternType;
                    if (patternAbsoluteYearlyRecurrence != null)
                    {
                        recurrence.Item = patternAbsoluteYearlyRecurrence;
                    }
                    else
                    {
                        RelativeYearlyRecurrencePatternType patternRelativeYearlyRecurrence = basePattern as RelativeYearlyRecurrencePatternType;
                        if (patternRelativeYearlyRecurrence != null)
                        {
                            recurrence.Item = patternRelativeYearlyRecurrence;
                        }
                    }
                }

                // Set the range's StartDate.
                DateTime startDate = startTime.AddMonths(1);
                range.StartDate = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 0, DateTimeKind.Utc);

                EndDateRecurrenceRangeType endDateRange = range as EndDateRecurrenceRangeType;
                if (endDateRange != null)
                {
                    if (patternAbsoluteYearlyRecurrence != null)
                    {
                        endDateRange.EndDate = range.StartDate.AddYears(8);
                    }
                    else
                    {
                        endDateRange.EndDate = range.StartDate.AddMonths(8);
                    }

                    recurrence.Item1 = endDateRange;
                }
                else
                {
                    recurrence.Item1 = range;
                }

                meetingItem.Recurrence = recurrence;

                meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) };
                meetingItem.Resources = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) };
            }

            return meetingItem;
        }
        /// <summary>
        /// Verify ModifiedOccurrences property of a recurring meeting.
        /// </summary>
        /// <param name="pattern">The recurring pattern.</param>
        /// <param name="range">The recurring range.</param>
        private void VerifyModifiedOccurrences(RecurrencePatternBaseType pattern, RecurrenceRangeBaseType range)
        {
            #region Step1: Organizer creates a recurring meeting
            // Define a recurring meeting.
            CalendarItemType meetingItem = this.DefineRecurringMeeting(pattern, range);
            Site.Assert.IsNotNull(meetingItem, "The meeting item should be created first.");

            // Create the recurring meeting.
            ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll);
            Site.Assert.IsNotNull(item, "The recurring meeting should be created successfully.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R494
            this.Site.CaptureRequirementIfIsNotNull(
                item,
                494,
                @"[In CreateItem Operation] This operation [CreateItem] can be used to create meetings.");

            item = this.GetSingleCalendarItem(Role.Organizer, item.Items.Items[0].ItemId);
            CalendarItemType calendar = item.Items.Items[0] as CalendarItemType;

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R742
            this.Site.CaptureRequirementIfAreEqual<int>(
                meetingItem.ConferenceType,
                calendar.ConferenceType,
                742,
                @"[In t:CalendarItemType Complex Type] [ConferenceType: Valid values include:] 1: presentation");
            #endregion

            #region Step2: Attendee gets and verifies the recurring meeting request
            int upperBound = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
            int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int count = 1;

            MeetingRequestMessageType request = null;

            while (request == null && count++ <= upperBound)
            {
               request = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.inbox, "IPM.Schedule.Meeting.Request", meetingItem.UID) as MeetingRequestMessageType;
               System.Threading.Thread.Sleep(waitTime);
            }
             
            Site.Assert.IsNotNull(request, "Attendee should receive the meeting request message in the Inbox folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendOnlyToAll.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R80048
                this.Site.CaptureRequirementIfIsFalse(
                    request.IsOrganizer,
                    80048,
                    @"[In Appendix C: Product Behavior] Implementation does support complex type ""IsOrganizer"" with type ""xs:boolean"" which specifies whether the current user is the organizer and/or owner of the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R903
                this.Site.CaptureRequirementIfIsNotNull(
                    request.Recurrence,
                    903,
                    @"[In Appendix C: Product Behavior] Implementation does support Recurrence which is a RecurrenceType element that represents the recurrence of the calendar item. (Exchange 2013 and above follow this behavior.)");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R28503
            this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                LegacyFreeBusyType.OOF,
                request.IntendedFreeBusyStatus,
                28503,
                @"[In t:MeetingRequestMessageType Complex Type] The IntendedFreeBusyStatus which value is ""OOF"" specifies the status as Out of Office (OOF).");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R807
                this.Site.CaptureRequirementIfIsNotNull(
                    request,
                    807,
                    @"[In Appendix C: Product Behavior] GetItemSoapIn: For each item being retrieved that is a recurring calendar item, implementation does contain a RecurringMasterItemId child element ([MS-OXWSCORE] section 2.2.4.11) or an OccurrenceItemId child element ([MS-OXWSCORE] section 2.2.4.11). (Exchange 2007 and above follow this behavior.)");
            }

            // Verify the calendar item
            calendar = this.SearchSingleItem(Role.Attendee, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendar, "The calendar item to be verified should exist in Attendee's Calendar folder.");

            ItemInfoResponseMessageType getItem = this.GetSingleCalendarItem(Role.Attendee, calendar.FirstOccurrence.ItemId);
            CalendarItemType firstOccurrence = getItem.Items.Items[0] as CalendarItemType;

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R54
            this.Site.CaptureRequirementIfAreEqual<CalendarItemTypeType>(
                CalendarItemTypeType.Occurrence,
                firstOccurrence.CalendarItemType1,
                54,
                @"[In t:CalendarItemTypeType Simple Type] Occurrence: Specifies that the item is an occurrence of a recurring calendar item.");

            #region Capture Code for CalendarItemType

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R744
            this.Site.CaptureRequirementIfIsTrue(
                calendar.AllowNewTimeProposalSpecified && calendar.AllowNewTimeProposal,
                744,
                @"[In t:CalendarItemType Complex Type] [AllowNewTimeProposal is] True, if a new meeting time can be proposed for a meeting by an attendee.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R56
            this.Site.CaptureRequirementIfAreEqual<CalendarItemTypeType>(
                CalendarItemTypeType.RecurringMaster,
                calendar.CalendarItemType1,
                56,
                @"[In t:CalendarItemTypeType Simple Type] RecurringMaster: Specifies that the item is the master item that contains the recurrence pattern for a calendar item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R732
            bool isChecked = calendar.IsRecurringSpecified && calendar.IsRecurring;
            this.Site.CaptureRequirementIfIsTrue(
                isChecked,
                732,
                @"[In t:CalendarItemType Complex Type] [IsRecurring is] True, if a calendar item is part of a recurring item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R737
            isChecked = calendar.IsResponseRequestedSpecified && calendar.IsResponseRequested;

            this.Site.CaptureRequirementIfIsFalse(
                isChecked,
                737,
                @"[In t:CalendarItemType Complex Type] otherwise [if a response to an item is not requested], [IsResponseRequested is] false.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R739
            this.Site.CaptureRequirementIfAreEqual<int>(
                3,
                calendar.AppointmentState,
                739,
                @"[In t:CalendarItemType Complex Type] [AppointmentState: Valid values include:] 3: the meeting request corresponding to the calendar item has been received");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R760
            isChecked = calendar.IsRecurringSpecified && calendar.IsRecurring;
            this.Site.CaptureRequirementIfIsTrue(
                isChecked,
                760,
                @"[In t:MeetingRequestMessageType Complex Type] [IsRecurring is] True, if the meeting is part of a recurring series of meetings.");

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R701
                this.Site.CaptureRequirementIfAreEqual<string>(
                    "Greenwich Standard Time",
                    calendar.StartTimeZoneId,
                    701,
                    @"[In Appendix C: Product Behavior] Implementation does support complex type ""StartTimeZoneId"" with type ""xs:string"" which specifies the calendar item start time zone identifier. (Exchange 2013 and above follow this behavior.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R702
                this.Site.CaptureRequirementIfAreEqual<string>(
                    "Greenwich Standard Time",
                    calendar.EndTimeZoneId,
                    702,
                    @"[In Appendix C: Product Behavior] Implementation does support complex type ""EndTimeZoneId"" with type ""xs:string"" which specifies the calendar item end time zone identifier. (Exchange 2013 and above follow this behavior.)");
            }

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

                // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R703
                this.Site.CaptureRequirementIfAreEqual<LegacyFreeBusyType>(
                    LegacyFreeBusyType.OOF,
                    calendar.IntendedFreeBusyStatus,
                    703,
                    @"[In Appendix C: Product Behavior] Implementation does support complex type ""IntendedFreeBusyStatus"" with type ""LegacyFreeBusyType ([MS-OXWSCDATA] section 2.2.3.16)"" which indicates how the organizer of the meeting wants it to show up in the attendee's calendar when the meeting is accepted. (Exchange 2013 and above follow this behavior.)");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R18407
            isChecked = !string.IsNullOrEmpty(calendar.Organizer.Item.EmailAddress);
            this.Site.CaptureRequirementIfIsTrue(
                isChecked,
                18407,
                @"[In t:CalendarItemType Complex Type] When the Mailbox element of Organizer element include an EmailAddress element of t:NonEmptyStringType, the t:NonEmptyStringType simple type specifies a string that MUST have a minimum of one character.");
            #endregion

            // Verify Recurrence
            Site.Assert.IsNotNull(calendar.Recurrence, "The Recurrence property of the calendar should not be null.");
            Site.Assert.IsNotNull(calendar.Recurrence.Item, "The pattern of the calendar should not be null.");
            Site.Assert.IsNotNull(calendar.Recurrence.Item1, "The range of the calendar should not be null.");
            this.VerifyReccurrenceType(calendar.Recurrence);
            #endregion

            #region Step3: Organizer updates one of the occurrences of the recurring meeting
            // Get the occurrence to be updated.
            ItemType occurrence = this.GetFirstOccurrenceItem(meetingItem, Role.Organizer);
            Site.Assert.IsNotNull(occurrence, "The specified occurrence item should be found.");

            // Update the occurrence.
            bool isUpdated = this.UpdateOccurrenceItem(occurrence);

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R651
            this.Site.CaptureRequirementIfIsTrue(
                isUpdated,
                651,
                @"[In Messages] UpdateItemSoapIn: For each item being updated that is a recurring calendar item, the ItemChange element can contain a RecurringMasterItemId child element ([MS-OXWSCORE] section 3.1.4.9.3.7) or an OccurrenceItemId child element ([MS-OXWSCORE] section 3.1.4.9.3.7).");

            CalendarItemType calendarItem = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", meetingItem.UID) as CalendarItemType;
            Site.Assert.IsNotNull(calendarItem, "The calendar item should exist.");
            Site.Assert.IsTrue(calendarItem.CalendarItemType1 == CalendarItemTypeType.RecurringMaster, "The type of the calendar should be RecurringMaster.");
            Site.Assert.IsNotNull(calendarItem.ModifiedOccurrences, "The ModifiedOccurrences should contain one occurrence at least.");

            #region Capture Code
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R377");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R377
            this.Site.CaptureRequirementIfAreEqual<string>(
                calendarItem.FirstOccurrence.ItemId.Id,
                calendarItem.ModifiedOccurrences[0].ItemId.Id,
                377,
                @"[In t:NonEmptyArrayOfOccurrenceInfoType Complex Type] Occurrence: Represents a modified occurrence of a recurring calendar item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R217
            this.Site.CaptureRequirementIfAreEqual<string>(
                calendarItem.FirstOccurrence.ItemId.Id,
                calendarItem.ModifiedOccurrences[0].ItemId.Id,
                217,
                @"[In t:CalendarItemType Complex Type]ModifiedOccurrences: Specifies recurring calendar item occurrences that have been modified so that they differ from original occurrences (or instances of the recurring master item).");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R381
            this.Site.CaptureRequirementIfAreEqual<string>(
                calendarItem.FirstOccurrence.ItemId.Id,
                calendarItem.ModifiedOccurrences[0].ItemId.Id,
                381,
                @"[In t:OccurrenceInfoType Complex Type] ItemId: Contains the identifier of a modified occurrence of a recurring calendar item.");

            CalendarItemType occurrenceCalendar = occurrence as CalendarItemType;
            Site.Assert.IsNotNull(occurrenceCalendar, "The type conversion from ItemType to CalendarItemType should succeed.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R383
            this.Site.CaptureRequirementIfAreEqual<DateTime>(
                occurrenceCalendar.Start.AddHours(-26.0),
                calendarItem.ModifiedOccurrences[0].Start,
                383,
                @"[In t:OccurrenceInfoType Complex Type] Start: Contains the start time of a modified occurrence of a recurring calendar item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R385
            this.Site.CaptureRequirementIfAreEqual<DateTime>(
                occurrenceCalendar.End.AddHours(-26.0),
                calendarItem.ModifiedOccurrences[0].End,
                385,
                @"[In t:OccurrenceInfoType Complex Type] End: Contains the end time of a modified occurrence of a recurring calendar item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R387
            this.Site.CaptureRequirementIfAreEqual<DateTime>(
                occurrenceCalendar.OriginalStart,
                calendarItem.ModifiedOccurrences[0].OriginalStart,
                387,
                @"[In t:OccurrenceInfoType Complex Type] OriginalStart: Contains the original start time of a modified occurrence of a recurring calendar item.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R161
            this.Site.CaptureRequirementIfAreEqual<DateTime>(
                occurrenceCalendar.Start,
                calendarItem.FirstOccurrence.OriginalStart,
                161,
                @"[In t:CalendarItemType Complex Type] OriginalStart: Represents the original start time of a calendar item (only for occurrences/exceptions).");
            #endregion
            #endregion

            #region Step4: Attendee gets and verifies the modified occurrence
            CalendarItemType updatedOccurrence = null;
            int counter = 0;
            while (counter < this.UpperBound)
            {
                System.Threading.Thread.Sleep(this.WaitTime);
                updatedOccurrence = this.GetFirstOccurrenceItem(meetingItem, Role.Attendee) as CalendarItemType;

                if (updatedOccurrence.Location.ToLower() == this.LocationUpdate.ToLower())
                {
                    break;
                }

                counter++;
            }

            if (counter == this.UpperBound && updatedOccurrence.Location.ToLower() != this.LocationUpdate.ToLower())
            {
                Site.Assert.Fail("Attendee should get the updates after organizer updates the meeting.");
            }

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R55
            this.Site.CaptureRequirementIfAreEqual<CalendarItemTypeType>(
                CalendarItemTypeType.Exception,
                updatedOccurrence.CalendarItemType1,
                55,
                @"[In t:CalendarItemTypeType Simple Type] Exception: Specifies that the item is an exception to a recurring calendar item.");

            Site.Assert.AreEqual<string>(
                this.LocationUpdate,
                updatedOccurrence.Location,
                string.Format("The value of Location property of the updated occurrence is Expected: {0}; Actual: {1}", this.LocationUpdate, updatedOccurrence.Location));
            #endregion

            #region Step5: Clean up organizer's calendar and deleteditems folders, and attendee's inbox, calendar and deleteditems folders.
            this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.deleteditems });
            this.CleanupFoldersByRole(Role.Attendee, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.deleteditems });
            #endregion
        }
        /// <summary>
        /// Verify recurrence pattern
        /// </summary>
        /// <param name="pattern">An instance of RecurrencePatternBaseType.</param>
        private void VerifyRecurrencePatternType(RecurrencePatternBaseType pattern)
        {
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R339");

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R339
            this.Site.CaptureRequirementIfIsNotNull(
                pattern,
                339,
                @"[In t:MeetingRequestMessageType Complex Type] Recurrence: Contains the recurrence pattern for meeting items and meeting requests.");

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

            // Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R390
            this.Site.CaptureRequirementIfIsNotNull(
                pattern,
                390,
                @"[In t:RecurrenceType Complex Type] The RecurrencePatternTypes group specifies the recurrence pattern for calendar items and meeting requests, as specified in [MS-OXWSCDATA] section 2.2.7.1.");

            AbsoluteMonthlyRecurrencePatternType absoluteMonthly = pattern as AbsoluteMonthlyRecurrencePatternType;
            if (absoluteMonthly != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R997");

                // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R997
                this.Site.CaptureRequirementIfAreEqual<int>(
                    5,
                    absoluteMonthly.DayOfMonth,
                    "MS-OXWSCDATA",
                    997,
                    @"[In t:AbsoluteMonthlyRecurrencePatternType Complex Type] This property [DayOfMonth] MUST be present.");
            }
            else
            {
                AbsoluteYearlyRecurrencePatternType absoluteYearly = pattern as AbsoluteYearlyRecurrencePatternType;
                if (absoluteYearly != null)
                {
                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1003");

                    // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R1003
                    this.Site.CaptureRequirementIfAreEqual<MonthNamesType>(
                        MonthNamesType.February,
                        absoluteYearly.Month,
                        "MS-OXWSCDATA",
                        1003,
                        @"[In t:AbsoluteYearlyRecurrencePatternType Complex Type] This property [Month] MUST be present.");

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

                    // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R1001
                    this.Site.CaptureRequirementIfAreEqual<int>(
                        5,
                        absoluteYearly.DayOfMonth,
                        "MS-OXWSCDATA",
                        1001,
                        @"[In t:AbsoluteYearlyRecurrencePatternType Complex Type] This property [DayOfMonth] MUST be present.");
                }
                else
                {
                    RelativeYearlyRecurrencePatternType relativeYearly = pattern as RelativeYearlyRecurrencePatternType;
                    if (relativeYearly != null)
                    {
                        // Add the debug information
                        this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1263");

                        // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R1263
                        this.Site.CaptureRequirementIfAreEqual<DayOfWeekIndexType>(
                            DayOfWeekIndexType.First,
                            relativeYearly.DayOfWeekIndex,
                            "MS-OXWSCDATA",
                            1263,
                            @"[In t:RelativeYearlyRecurrencePatternType Complex Type] This element [DayOfWeekIndex] MUST be present.");

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

                        // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R1261
                        this.Site.CaptureRequirementIfAreEqual<string>(
                            "Wednesday",
                            relativeYearly.DaysOfWeek,
                            "MS-OXWSCDATA",
                            1261,
                            @"[In t:RelativeYearlyRecurrencePatternType Complex Type] This element [DaysOfWeek] MUST be present.");

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

                        // Verify MS-OXWSMTGS requirement: MS-OXWSCDATA_R1265
                        this.Site.CaptureRequirementIfAreEqual<MonthNamesType>(
                            MonthNamesType.January,
                            relativeYearly.Month,
                            "MS-OXWSCDATA",
                            1265,
                            @"[In t:RelativeYearlyRecurrencePatternType Complex Type] This element [Month] MUST be present.");
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Verify RecurrencePatternBaseType structure.
        /// </summary>
        /// <param name="recurrencePatternBaseType">Specifies the recurrence pattern for calendar items and meeting requests.</param>
        /// <param name="isSchemaValidated">The result of schema validation, true means valid.</param>
        private void VerifyRecurrencePatternTypes(RecurrencePatternBaseType recurrencePatternBaseType, bool isSchemaValidated)
        {
            RelativeYearlyRecurrencePatternType relativeYearlyRecurrencePatternType = recurrencePatternBaseType as RelativeYearlyRecurrencePatternType;
            if (relativeYearlyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1259");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1259
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    1259,
                    @"[In t:RelativeYearlyRecurrencePatternType Complex Type] The type [RelativeYearlyRecurrencePatternType] is defined as follow:
        <xs:complexType name=""RelativeYearlyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:RecurrencePatternBaseType""
            >
              <xs:sequence>
                <xs:element name=""DaysOfWeek""
                  type=""t:DayOfWeekType""
                 />
                <xs:element name=""DayOfWeekIndex""
                  type=""t:DayOfWeekIndexType""
                 />
                <xs:element name=""Month""
                  type=""t:MonthNamesType""
                 />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>");

                this.VerifyDayOfWeekIndexType(isSchemaValidated);
                this.VerifyMonthNamesType(isSchemaValidated);
            }

            AbsoluteYearlyRecurrencePatternType absoluteYearlyRecurrencePatternType = recurrencePatternBaseType as AbsoluteYearlyRecurrencePatternType;
            if (absoluteYearlyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R999");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R999
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    999,
                    @"[In t:AbsoluteYearlyRecurrencePatternType Complex Type] The type [AbsoluteYearlyRecurrencePatternType] is defined as follow:
        <xs:complexType name=""AbsoluteYearlyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:RecurrencePatternBaseType""
            >
              <xs:sequence>
                <xs:element name=""DayOfMonth""
                  type=""xs:int""
                 />
                <xs:element name=""Month""
                  type=""t:MonthNamesType""
                 />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>");

                this.VerifyMonthNamesType(isSchemaValidated);
            }

            RelativeMonthlyRecurrencePatternType relativeMonthlyRecurrencePatternType = recurrencePatternBaseType as RelativeMonthlyRecurrencePatternType;
            if (relativeMonthlyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1255");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1255
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    1255,
                    @"[In t:RelativeMonthlyRecurrencePatternType Complex Type] The type [RelativeMonthlyRecurrencePatternType] is defined as follow:
        <xs:complexType name=""RelativeMonthlyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:IntervalRecurrencePatternBaseType""
            >
              <xs:sequence>
                <xs:element name=""DaysOfWeek""
                  type=""t:DayOfWeekType""
                 />
                <xs:element name=""DayOfWeekIndex""
                  type=""t:DayOfWeekIndexType""
                 />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>");

                this.VerifyDayOfWeekType(isSchemaValidated);
                this.VerifyDayOfWeekIndexType(isSchemaValidated);
            }

            AbsoluteMonthlyRecurrencePatternType absoluteMonthlyRecurrencePatternType = recurrencePatternBaseType as AbsoluteMonthlyRecurrencePatternType;
            if (absoluteMonthlyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R995");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R995
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    995,
                    @"[In t:AbsoluteMonthlyRecurrencePatternType Complex Type] The type [AbsoluteMonthlyRecurrencePatternType] is defined as follow:
        <xs:complexType name=""AbsoluteMonthlyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:IntervalRecurrencePatternBaseType""
            >
              <xs:sequence>
                <xs:element name=""DayOfMonth""
                  type=""xs:int""
                 />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>");
            }

            WeeklyRecurrencePatternType weeklyRecurrencePatternType = recurrencePatternBaseType as WeeklyRecurrencePatternType;
            if (weeklyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1307");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1307
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    1307,
                    @"[In t:WeeklyRecurrencePatternType Complex Type] The type [WeeklyRecurrencePatternType] is defined as follow:
        <xs:complexType name=""WeeklyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:IntervalRecurrencePatternBaseType""
            >
              <xs:sequence>
                <xs:element name=""DaysOfWeek""
                  type=""t:DaysOfWeekType""
                 />
                <xs:element name=""FirstDayOfWeek""
                  type=""t:DayOfWeekType""
                  minOccurs=""0""
                 />
              </xs:sequence>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>");
            }

            DailyRecurrencePatternType dailyRecurrencePatternType = recurrencePatternBaseType as DailyRecurrencePatternType;
            if (dailyRecurrencePatternType != null)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1109");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1109
                this.Site.CaptureRequirementIfIsTrue(
                    isSchemaValidated,
                    "MS-OXWSCDATA",
                    1109,
                    @"[In t:DailyRecurrencePatternType Complex Type] The type [DailyRecurrencePatternType] is defined as follow:
         <xs:complexType name=""DailyRecurrencePatternType"">
          <xs:complexContent>
            <xs:extension
              base=""t:IntervalRecurrencePatternBaseType""
             />
          </xs:complexContent>
        </xs:complexType>");
            }
        }