예제 #1
0
        public void MinimumTakeOffPercentageTest()
        {
            var passengers = new List <IPassenger>();

            passengers.Add(GetGeneralPassenger());
            passengers.Add(GetGeneralPassenger());
            passengers.Add(GetGeneralPassenger());
            passengers.Add(GetGeneralPassenger());
            passengers.Add(GetGeneralPassenger());

            _scheduledFlight.Passengers = passengers;
            _scheduledFlight.CalculateFlightDetails();

            // 5 Passengers
            _scheduledFlight.ConfirmFlightViability().Should().BeFalse();
            _scheduledFlight.NetProfit.Should().Be(250);
            _scheduledFlight.CostOfFlight.Should().Be(250);
            _scheduledFlight.ProfitFromFlight.Should().Be(500);
            _scheduledFlight.TotalExpectedBaggage.Should().Be(5);
            _scheduledFlight.TotalLoyaltyPointsAccrued.Should().Be(0);
            _scheduledFlight.TotalLoyaltyPointsRedeemed.Should().Be(0);

            _scheduledFlight.AddPassenger(GetGeneralPassenger());
            _scheduledFlight.CalculateFlightDetails();

            // 6 Passengers
            _scheduledFlight.ConfirmFlightViability().Should().BeTrue();
            _scheduledFlight.NetProfit.Should().Be(300);
            _scheduledFlight.CostOfFlight.Should().Be(300);
            _scheduledFlight.ProfitFromFlight.Should().Be(600);
            _scheduledFlight.TotalExpectedBaggage.Should().Be(6);
            _scheduledFlight.TotalLoyaltyPointsAccrued.Should().Be(0);
            _scheduledFlight.TotalLoyaltyPointsRedeemed.Should().Be(0);

            _scheduledFlight.AddPassenger(GetGeneralPassenger());
            _scheduledFlight.CalculateFlightDetails();

            // 7 Passengers
            _scheduledFlight.ConfirmFlightViability().Should().BeTrue();
            _scheduledFlight.NetProfit.Should().Be(350);
            _scheduledFlight.CostOfFlight.Should().Be(350);
            _scheduledFlight.ProfitFromFlight.Should().Be(700);
            _scheduledFlight.TotalExpectedBaggage.Should().Be(7);
            _scheduledFlight.TotalLoyaltyPointsAccrued.Should().Be(0);
            _scheduledFlight.TotalLoyaltyPointsRedeemed.Should().Be(0);
        }