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); }
public void DeleteCalendarEvent(CalendarEventViewModel calendarEventViewModel) { calendar.RemoveEvent(calendarEventViewModel.CalendarEvent); BuildEventSlots(); RefreshUIDayEventSlots(); SaveCalendarToFile(); }