public void GetTimeSlotMappedToCalendarTimeFrame_Returns_A_New_TimeSlot_Mapped_To_Calendar_Time() { var calendar = new Calendar(DateTime.Now.AddHours(1), DateTime.Now.AddHours(3)); var meeting1 = new MeetingInfo(DateTime.Now.AddMinutes(75), DateTime.Now.AddMinutes(105)); //T T var meeting2 = new MeetingInfo(DateTime.Now.AddMinutes(75), DateTime.Now.AddHours(4)); //T F var meeting3 = new MeetingInfo(DateTime.Now.AddHours(-1), DateTime.Now.AddMinutes(105)); //F T var meeting4 = new MeetingInfo(DateTime.Now.AddHours(-1), DateTime.Now.AddHours(4)); //F F var mappedTime = meeting1.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime.StartTime, Is.EqualTo(meeting1.StartTime)); Assert.That(mappedTime.EndTime, Is.EqualTo(meeting1.EndTime)); mappedTime = meeting2.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime.StartTime, Is.EqualTo(meeting2.StartTime)); Assert.That(mappedTime.EndTime, Is.EqualTo(calendar.EndTime)); mappedTime = meeting3.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime.StartTime, Is.EqualTo(calendar.StartTime)); Assert.That(mappedTime.EndTime, Is.EqualTo(meeting3.EndTime)); mappedTime = meeting4.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime.StartTime, Is.EqualTo(calendar.StartTime)); Assert.That(mappedTime.EndTime, Is.EqualTo(calendar.EndTime)); }
public void GetTimeSlotMappedToCalendarTimeFrame_Returns_Null_When_TimeSlot_Is_Outside_Of_Calendar_TimeFrame() { var calendar = new Calendar(DateTime.Now.AddHours(2), DateTime.Now.AddHours(6)); var meeting1 = new MeetingInfo(DateTime.Now.AddHours(1), DateTime.Now.AddHours(2)); var meeting2 = new MeetingInfo(DateTime.Now.AddHours(7), DateTime.Now.AddHours(8)); var mappedTime = meeting1.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime, Is.Null); mappedTime = meeting2.GetTimeSlotMappedToCalendarTimeFrame(calendar.StartTime, calendar.EndTime); Assert.That(mappedTime, Is.Null); }