public void LoadEventsTest_NotAllInWindow() { Day day1 = new Day(DateTime.ParseExact("11-01-2000", "dd-MM-yyyy", CultureInfo.InvariantCulture)); Day day2 = new Day(DateTime.ParseExact("12-03-2000", "dd-MM-yyyy", CultureInfo.InvariantCulture)); day1.AddEvent(new Appointment { Title = "a" }); day1.AddEvent(new Appointment { Title = "b" }); day2.AddEvent(new Appointment { Title = "b" }); calendar.AllDays = new List <Day>(new Day[] { day1, day2 }); ObservableCollection <Day> testList = calendar.LoadEvents(DateTime.ParseExact("11-01-2000", "dd-MM-yyyy", CultureInfo.InvariantCulture), DateTime.ParseExact("07-02-2000", "dd-MM-yyyy", CultureInfo.InvariantCulture)); Assert.AreEqual(testList.Count, 1, "Alldays in loaded"); Assert.IsTrue(testList.Contains(day1)); Assert.IsFalse(testList.Contains(day2)); }
// Getters // Setters public void AddEvent(ItemEvent i, Date date) { Day day = new Day(date); int index = calendar.BinarySearch(day); if (index <= -1) { day.AddEvent(i); this.calendar.Add(day); } else { day = calendar[index]; day.AddEvent(i); } }
public void DayShouldHaveEvents() { var day = new Day(DateTime.Now); var @event = new Event(1, "Name", DateTime.Now, DateTime.Now, false); day.AddEvent(@event); var hasEvents = day.HasEvents; Assert.IsTrue(hasEvents); }
public void EventsShouldBeAdded() { var day = new Day(DateTime.Now); var @event = new Event(1, "Name", DateTime.Now, DateTime.Now, false); day.AddEvent(@event); var events = day.Events; Assert.IsNotEmpty(events); }
public void AllEventsShouldBeRemoved() { var day = new Day(DateTime.Now); var @event = new Event(1, "Name", DateTime.Now, DateTime.Now, false); day.AddEvent(@event); day.RemoveAllEvents(); Assert.IsEmpty(day.Events); }
public void VisibilityShouldBeTrueIfDayHaveEvents() { var dateTime = DateTime.Now; var day = new Day(dateTime); day.AddEvent(new Event(1, "Name", dateTime, dateTime, false)); var converter = new HasEventsToVisibilityConverter(); var result = (bool)converter.Convert(day, null, null, null); Assert.IsTrue(result); }