public async Task GetAllOrderedByStart_ShouldReturnOrderedByStartList() { var context = new EventuresDbContext(this.Options); var events = new List <Event> { new Event { Start = DateTime.UtcNow.AddDays(1) }, new Event { Start = DateTime.UtcNow.AddDays(3) }, new Event { Start = DateTime.UtcNow.AddDays(2) }, }; await context.Events.AddRangeAsync(events); await context.SaveChangesAsync(); var eventsService = new EventsService(context); var serviceResult = eventsService.GetAllOrderedByStart(); var expected = events.OrderBy(e => e.Start); Assert.Equal(expected, serviceResult); }
public async Task GetAllOrderedByStart_EmptyDbSetShouldReturnEmptyList() { var context = new EventuresDbContext(this.Options); var events = new List <Event> { }; await context.Events.AddRangeAsync(events); await context.SaveChangesAsync(); var eventsService = new EventsService(context); var serviceResult = eventsService.GetAllOrderedByStart(); var expected = events.OrderBy(e => e.Start); Assert.Equal(expected, serviceResult); }