public void GetEvents_4DayView_Success() { //Arrange var startDate = new DateTime(2015, 2, 10); var endDate = new DateTime(2015, 2, 13); var eventViewer = new EventViewer(_eventsRepositoryMock.Object); //Act Dictionary <DateTime, List <EventDto> > result = eventViewer.GetEvents(startDate, endDate); //Assert Assert.IsNotEmpty(result); Assert.AreEqual(7, result[startDate].Count); Assert.False(result[startDate].Any(e => e.Title == "Complex event 1")); Assert.False(result[startDate].Any(e => e.Title == "Complex event 2")); for (int i = 1; i < 4; i++) { Assert.AreEqual(1, result[startDate.AddDays(i)].Count); Assert.True(result[startDate.AddDays(i)].Any(e => e.Title == "Daily event")); } }
public void GetEvents_MonthView_Success() { //Arrange var startDate = new DateTime(2015, 2, 1); var endDate = new DateTime(2015, 2, 28); var eventViewer = new EventViewer(_eventsRepositoryMock.Object); //Act Dictionary <DateTime, List <EventDto> > result = eventViewer.GetEvents(startDate, endDate); //Assert Assert.IsNotEmpty(result); for (int i = 0; i < 9; i++) { Assert.IsEmpty(result[startDate.AddDays(i)]); } Assert.AreEqual(7, result[startDate.AddDays(9)].Count); Assert.False(result[startDate.AddDays(9)].Any(e => e.Title == "Complex event 1")); Assert.False(result[startDate.AddDays(9)].Any(e => e.Title == "Complex event 2")); for (int i = 10; i < 28; i++) { if (i == 16 || i == 23) { Assert.AreEqual(2, result[startDate.AddDays(i)].Count); Assert.True(result[startDate.AddDays(i)].Any(e => e.Title == "Daily event")); Assert.True(result[startDate.AddDays(i)].Any(e => e.Title == "Weekly event")); } else { Assert.AreEqual(1, result[startDate.AddDays(i)].Count); Assert.True(result[startDate.AddDays(i)].Any(e => e.Title == "Daily event")); } } }