public async Task GetBookingsAsync_WhenNoData() { // Create test data before the call _context.Bookings.RemoveRange(_context.Bookings); _context.SaveChanges(); // Make the call DefaultBookingService service = new DefaultBookingService(_context); var result = await service.GetBookingsAsync(CancellationToken.None); // Validate the result Assert.NotNull(result); Assert.Equal(0, Enumerable.Count <Booking>(result)); }
public async Task GetBookingsAsync_WhenHasData() { // Create test data before the call var bookings = BookingEntity.GenerateTestData(); _context.Bookings.AddRange(bookings); _context.SaveChanges(); // Make the call DefaultBookingService service = new DefaultBookingService(_context); var result = await service.GetBookingsAsync(CancellationToken.None); // Validate the result Assert.NotNull(result); Assert.Equal(bookings.Length, Enumerable.Count <Booking>(result)); }