Esempio n. 1
0
        public void Build_WhenCall_Returns_Timeslots_For_Sunday()
        {
            GetTimeSlotsProcess process = new GetTimeSlotsProcess(_mockLogger.Object);

            TimeSpan CallbackTimeSlotStartTime = TimeSpan.Parse("14:00");
            TimeSpan CallbackTimeSlotEndTime   = TimeSpan.Parse("08:00");

            List <KeyValuePair <string, string> > list = process.Build(CallbackTimeSlotStartTime, CallbackTimeSlotEndTime);

            Assert.AreEqual(1, list.Count);
        }
Esempio n. 2
0
        public void Build_WhenCall_Returns_Timeslots_For_Saturday()
        {
            GetTimeSlotsProcess process = new GetTimeSlotsProcess(_mockLogger.Object);

            TimeSpan CallbackTimeSlotSaturdayStartTime = TimeSpan.Parse("08:00");
            TimeSpan CallbackTimeSlotSaturdayEndTime   = TimeSpan.Parse("14:00");

            List <KeyValuePair <string, string> > list = process.Build(CallbackTimeSlotSaturdayStartTime, CallbackTimeSlotSaturdayEndTime);

            Assert.AreEqual(4, list.Count);

            AssertKeyValuePair(null, "Time slot", list[0]);
            AssertKeyValuePair("08:00 AM - 10:00 AM", "08:00 AM - 10:00 AM", list[1]);
            AssertKeyValuePair("10:00 AM - 12:00 PM", "10:00 AM - 12:00 PM", list[2]);
            AssertKeyValuePair("12:00 PM - 02:00 PM", "12:00 PM - 02:00 PM", list[3]);
        }
Esempio n. 3
0
        public void GetSlots(string start, string end, string current, int slotDuration, int expected)
        {
            var process = new GetTimeSlotsProcess(_mockLogger.Object);

            var startDateTime   = DateTime.Parse(start);
            var endDateTime     = DateTime.Parse(end);
            var currentDateTime = DateTime.Parse(current);

            var result = process.GetSlots(startDateTime, endDateTime, currentDateTime, slotDuration);

            Assert.AreEqual(result[0].Key, null);
            Assert.AreEqual(result[0].Value, "Time slot");

            result.Remove(new KeyValuePair <string, string>(null, "Time slot"));

            Assert.AreEqual(result.Count, expected);
        }
Esempio n. 4
0
        public void Build_WhenCall_Returns_Timeslots_For_Today()
        {
            GetTimeSlotsProcess process = new GetTimeSlotsProcess(_mockLogger.Object);

            DateTime currDate = DateTime.UtcNow;

            TimeSpan CallbackTimeSlotWeekdayStartTime = TimeSpan.Parse("08:00");
            TimeSpan CallbackTimeSlotWeekdayEndTime   = TimeSpan.Parse("20:00");

            TimeSpan CallbackTimeSlotSaturdayStartTime = TimeSpan.Parse("08:00");
            TimeSpan CallbackTimeSlotSaturdayEndTime   = TimeSpan.Parse("14:00");

            if (currDate.DayOfWeek == DayOfWeek.Saturday)
            {
                List <KeyValuePair <string, string> > list = process.GetSlots(ToDateTime(CallbackTimeSlotSaturdayStartTime), ToDateTime(CallbackTimeSlotSaturdayEndTime), currDate, 2);
                Assert.IsNotNull(list);
            }
            else
            {
                List <KeyValuePair <string, string> > list = process.GetSlots(ToDateTime(CallbackTimeSlotWeekdayStartTime), ToDateTime(CallbackTimeSlotWeekdayEndTime), currDate, 2);
                Assert.IsNotNull(list);
            }
        }