예제 #1
0
        public static void CalendarMethods()
        {
            CalendarModel calendar       = new CalendarModel();
            var           emptyEventList = calendar.GetEventsAtDateTime(DateTime.UnixEpoch);

            Assert.AreEqual(emptyEventList.Count, 0);

            int      startingHour    = 0;
            int      endingHour      = 1;
            int      startingMinutes = 0;
            int      endingMinutes   = 30;
            DateTime eventDate       = DateTime.Today;

            CalendarEvent calendarEvent = new CalendarEvent("Test", DateTime.Today, startingHour, startingMinutes, endingHour, endingMinutes, "rodrigo", "description", "");

            calendar.AddEvent(calendarEvent);

            int expectedEventsAtDateTime = 1;

            Assert.AreEqual(calendar.GetEventsAtDateTime(eventDate).Count, expectedEventsAtDateTime);

            int expectedEventsAfterEventRemoval = 0;

            calendar.RemoveEvent(calendarEvent);
            Assert.AreEqual(calendar.GetEventsAtDateTime(eventDate).Count, expectedEventsAfterEventRemoval);
        }
예제 #2
0
 public void DeleteCalendarEvent(CalendarEventViewModel calendarEventViewModel)
 {
     calendar.RemoveEvent(calendarEventViewModel.CalendarEvent);
     BuildEventSlots();
     RefreshUIDayEventSlots();
     SaveCalendarToFile();
 }