Ejemplo n.º 1
0
        public void OneCalendarFullyBooked()
        {
            var calendar1 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(9, 0, 0), new TimeSpan(19, 55, 0))
            };
            var calendar2 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(10, 0, 0), new TimeSpan(18, 30, 0))
            };

            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(9, 0, 0), new TimeSpan(12, 0, 0)));
            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(12, 0, 0), new TimeSpan(16, 0, 0)));
            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(16, 0, 0), new TimeSpan(18, 0, 0)));
            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(18, 0, 0), new TimeSpan(19, 55, 0)));

            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(10, 0, 0), new TimeSpan(11, 30, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(12, 30, 0), new TimeSpan(14, 30, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(14, 30, 0), new TimeSpan(15, 0, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(16, 0, 0), new TimeSpan(17, 0, 0)));

            var expectedOutput = "[]";
            var output         = MeetingPlanner.GetPossibleMeetingTimes(calendar1, calendar2, new TimeSpan(0, 30, 0));

            Assert.Equal(expectedOutput, MeetingPlanner.FormatOutput(output));
        }
Ejemplo n.º 2
0
        public void ExampleCase()
        {
            var calendar1 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(9, 0, 0), new TimeSpan(19, 55, 0))
            };
            var calendar2 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(10, 0, 0), new TimeSpan(18, 30, 0))
            };

            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(9, 0, 0), new TimeSpan(10, 30, 0)));
            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(12, 0, 0), new TimeSpan(13, 0, 0)));
            calendar1.PlannedMeetings.Add(new Duration(new TimeSpan(16, 0, 0), new TimeSpan(18, 0, 0)));

            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(10, 0, 0), new TimeSpan(11, 30, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(12, 30, 0), new TimeSpan(14, 30, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(14, 30, 0), new TimeSpan(15, 0, 0)));
            calendar2.PlannedMeetings.Add(new Duration(new TimeSpan(16, 0, 0), new TimeSpan(17, 0, 0)));

            var expectedOutput = "[[\"11:30\",\"12:00\"],[\"15:00\",\"16:00\"],[\"18:00\",\"18:30\"]]";
            var output         = MeetingPlanner.GetPossibleMeetingTimes(calendar1, calendar2, new TimeSpan(0, 30, 0));

            Assert.Equal(expectedOutput, MeetingPlanner.FormatOutput(output));
        }
Ejemplo n.º 3
0
        public void EmptyCalendars()
        {
            var expectedOutput = "[]";
            var output         = MeetingPlanner.GetPossibleMeetingTimes(new Calendar(), new Calendar(), new TimeSpan(0, 30, 0));

            Assert.Equal(expectedOutput, MeetingPlanner.FormatOutput(output));
        }
Ejemplo n.º 4
0
        public void WorkingHoursNotOverlapping()
        {
            var calendar1 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(5, 30, 0), new TimeSpan(12, 0, 0))
            };
            var calendar2 = new Calendar()
            {
                WorkingHours = new Duration(new TimeSpan(12, 30, 0), new TimeSpan(20, 30, 0))
            };

            var expectedOutput = "[]";
            var output         = MeetingPlanner.GetPossibleMeetingTimes(calendar1, calendar2, new TimeSpan(0, 30, 0));

            Assert.Equal(expectedOutput, MeetingPlanner.FormatOutput(output));
        }