Microsoft.Protocols.TestSuites.MS_ASCAL.S01_CalendarElement.MSASCAL_S01_TC05_CalendarWithoutStartTimeEndTime C# (CSharp) Method

MSASCAL_S01_TC05_CalendarWithoutStartTimeEndTime() private method

private MSASCAL_S01_TC05_CalendarWithoutStartTimeEndTime ( ) : void
return void
        public void MSASCAL_S01_TC05_CalendarWithoutStartTimeEndTime()
        {
            #region Call Sync command to add a calendar without StartTime element and EndTime element to the server, and sync calendars from the server.
            Dictionary<Request.ItemsChoiceType8, object> calendarItem = new Dictionary<Request.ItemsChoiceType8, object>();
            string subjectWithoutStartTimeAndEndTime = Common.GenerateResourceName(Site, "subjectWithoutStartTimeAndEndTime");
            calendarItem.Add(Request.ItemsChoiceType8.Subject, subjectWithoutStartTimeAndEndTime);

            calendarItem.Add(Request.ItemsChoiceType8.StartTime, null);
            calendarItem.Add(Request.ItemsChoiceType8.EndTime, null);

            this.AddSyncCalendar(calendarItem);

            SyncItem calendarWithoutStartTimeAndEndTime = this.GetChangeItem(this.User1Information.CalendarCollectionId, subjectWithoutStartTimeAndEndTime);

            Site.Assert.IsNotNull(calendarWithoutStartTimeAndEndTime.Calendar, "The calendar with subject {0} should exist in server.", subjectWithoutStartTimeAndEndTime);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.CalendarCollectionId, subjectWithoutStartTimeAndEndTime);

            #endregion

            Site.Assert.IsNotNull(calendarWithoutStartTimeAndEndTime.Calendar.StartTime, "The StartTime element should not be null.");
            Site.Assert.IsNotNull(calendarWithoutStartTimeAndEndTime.Calendar.DtStamp, "The DtStamp element should not be null.");
            Site.Assert.IsNotNull(calendarWithoutStartTimeAndEndTime.Calendar.EndTime, "The EndTime element should not be null.");

            // If start time is rounded to the nearest half hour.
            bool isRoundedTime = (calendarWithoutStartTimeAndEndTime.Calendar.StartTime.Value.Minute == 0 || calendarWithoutStartTimeAndEndTime.Calendar.StartTime.Value.Minute == 30) && (((TimeSpan)(calendarWithoutStartTimeAndEndTime.Calendar.StartTime - calendarWithoutStartTimeAndEndTime.Calendar.DtStamp)).Minutes <= 30);

            Site.Assert.AreEqual<bool>(true, isRoundedTime, "StartTime should be rounded time");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R52511
            Site.CaptureRequirementIfIsTrue(
                (calendarWithoutStartTimeAndEndTime.Calendar.EndTime.Value - calendarWithoutStartTimeAndEndTime.Calendar.StartTime.Value).Minutes == 30,
                52511,
                @"[In Creating Calendar Events when the StartTime Element or EndTime Element is Absent] If the server receives a Sync command request ([MS-ASCMD] section 2.2.2.19) to add a calendar event that is missing either the StartTime element (section 2.2.2.40), the EndTime element (section 2.2.2.18), or both, the server attempts to substitute values based on the current time, rounded to the nearest half hour, for the missing values. ");

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

            // Verify MS-ASCAL requirement: MS-ASCAL_R52514
            Site.CaptureRequirementIfIsTrue(
                (calendarWithoutStartTimeAndEndTime.Calendar.EndTime.Value - calendarWithoutStartTimeAndEndTime.Calendar.StartTime.Value).Minutes == 30,
                52514,
                @"[In Creating Calendar Events when the StartTime Element or EndTime Element is Absent] If StartTime and EndTime are both absent the server sets the value of the StartTime element to the rounded current time, and sets the value of the EndTime element to the rounded current time plus 30 minutes.");
        }