示例#1
0
        public void ShouldGetFlights()
        {
            var expectedFlightCount = 30;
            var dummyFlights        = FakeData.GenerateDummyFlight(expectedFlightCount);

            _flightRepoMoq.Setup(s => s.LoadFlights()).Returns(() => dummyFlights);
            var module  = new FlightModule(_flightRepoMoq.Object);
            var flights = module.LoadFlights();

            Assert.AreEqual(expectedFlightCount, flights.Count);
        }
示例#2
0
        public void ShouldCalculateFuelBetwenTwoAirportsWhenGetFlight()
        {
            var expectedAmountOfFuel        = 46808.6;
            var dummyFlightBetweenCasaParis = FakeData.GetFlightBetweenCasaParis();

            _flightRepoMoq.Setup(s => s.LoadFlights()).Returns(() => new List <Flight>()
            {
                dummyFlightBetweenCasaParis
            });
            var module = new FlightModule(_flightRepoMoq.Object);
            var result = module.LoadFlights().SingleOrDefault();

            Assert.AreEqual(expectedAmountOfFuel, result.AmountOfFuel);
        }
示例#3
0
        public void ShouldCalculateDistanceBetwenTwoAirportsWhenGetFlight()
        {
            var expectedDistanceInKm        = 1933;
            var dummyFlightBetweenCasaParis = FakeData.GetFlightBetweenCasaParis();

            _flightRepoMoq.Setup(s => s.LoadFlights()).Returns(() => new List <Flight>()
            {
                dummyFlightBetweenCasaParis
            });
            var module = new FlightModule(_flightRepoMoq.Object);
            var result = module.LoadFlights().SingleOrDefault();

            Assert.AreEqual(expectedDistanceInKm, result.DistanceInKM);
        }