Ejemplo n.º 1
0
        public async Task GetFlightsAsync_WhenNoData()
        {
            // Create test data before the call
            _context.Flights.RemoveRange(_context.Flights);
            _context.SaveChanges();

            // Make the call
            DefaultFlightService service = new DefaultFlightService(_context);
            var result = await service.GetFlightsAsync(CancellationToken.None);

            // Validate the result
            Assert.NotNull(result);
            Assert.Equal(0, Enumerable.Count <Flight>(result));
        }
Ejemplo n.º 2
0
        public async Task GetFlightsAsync_WhenHasData()
        {
            // Create test data before the call
            var flights = FlightEntity.GenerateTestData();

            _context.Flights.AddRange(flights);
            _context.SaveChanges();

            // Make the call
            DefaultFlightService service = new DefaultFlightService(_context);
            var result = await service.GetFlightsAsync(CancellationToken.None);

            // Validate the result
            Assert.NotNull(result);
            Assert.Equal(flights.Length, Enumerable.Count <Flight>(result));
        }