Example #1
0
        public async void CanGetOriginDelay()
        {
            // Arrange
            var items =
                Builder <FlightDc> .
                CreateListOfSize(30)
                .TheFirst(5)
                .With(x => x.Origin    = "EWR")
                .With(x => x.Arr_Delay = 10)
                .With(x => x.Dep_Delay = 10)
                .TheNext(5)
                .With(x => x.Origin    = "EWR")
                .With(x => x.Arr_Delay = 20)
                .With(x => x.Dep_Delay = 20)
                .TheNext(5)
                .With(x => x.Origin    = "JFK")
                .With(x => x.Arr_Delay = 10)
                .With(x => x.Dep_Delay = 10)
                .TheNext(5)
                .With(x => x.Origin    = "JFK")
                .With(x => x.Arr_Delay = 20)
                .With(x => x.Dep_Delay = 20)
                .TheNext(5)
                .With(x => x.Origin    = "LGA")
                .With(x => x.Arr_Delay = 10)
                .With(x => x.Dep_Delay = 10)
                .TheNext(5)
                .With(x => x.Origin    = "LGA")
                .With(x => x.Arr_Delay = 20)
                .With(x => x.Dep_Delay = 20)
                .Build();

            context.Flights.AddRange(items);
            context.SaveChanges();

            // Act
            var result = await flightsRepository.GetOriginDelays();

            // Assert
            Assert.Equal(15, result.EWRArrivalDelay);
            Assert.Equal(15, result.EWRDepartureDelay);
            Assert.Equal(15, result.JFKArrivalDelay);
            Assert.Equal(15, result.JFKDepartureDelay);
            Assert.Equal(15, result.LGAArrivalDelay);
            Assert.Equal(15, result.LGADepartureDelay);
        }