Ejemplo n.º 1
0
        public bool IsPassengerCountOnAircraftAboveMaxSeats_EnsurePassangersFitOnFlight(int seatCount, int numberOfPassengers)
        {
            _aircraftServiceMock.Setup(asrv => asrv.GetNumberOfSeatsOnPlane()).Returns(seatCount);
            _passengerServiceMock.Setup(ps => ps.GetNumberOfPassengers()).Returns(numberOfPassengers);

            var canPassengersFit = _flightValidationService.IsPassengerCountOnAircraftAboveMaxSeats();

            return(canPassengersFit);
        }
Ejemplo n.º 2
0
        public Models.FlightSummary CreateFlightSummary()
        {
            var totalFlightDiscount                 = _cashFlowCalculationService.CalculateDiscountedAmountForPassengersOnFlight();
            var loyaltyPointsUsed                   = (int)totalFlightDiscount;
            var totalRevenueFromPayingCustomers     = _cashFlowCalculationService.CalculateTotalRevenueFromPayingCustomers();
            var costOfFlightToAirline               = _cashFlowCalculationService.CalculateTotalCostOfFlightToAirline();
            var isPassengersWithinSeatCountOnPlane  = _flightValidationService.IsPassengerCountOnAircraftAboveMaxSeats();
            var isAdjustedRevenueWithinCostOfFLight = _flightValidationService.IsAdjustedRevenueWithinCostOfFlight();

            return(new Models.FlightSummary()
            {
                Passengers = _passengerService.GetNumberOfPassengers(),
                GeneralPassengers = _passengerService.GetNumberOfGeneralPassengers(),
                AirlinePassengers = _passengerService.GetNumberOfAirlinePassengers(),
                LoyaltyPassengers = _passengerService.GetNumberOfLoyaltyPassengers(),
                Bags = _passengerService.GetPassengerBags(),
                LoyaltyPointsUsed = loyaltyPointsUsed,
                CostOfFlight = (int)costOfFlightToAirline,
                RevenueBeforeDiscounts = (int)_cashFlowCalculationService.CalculateTotalRevenue(),
                RevenueAfterDiscounts = (int)(totalRevenueFromPayingCustomers - totalFlightDiscount),
                CanFlightProceed = isPassengersWithinSeatCountOnPlane && isAdjustedRevenueWithinCostOfFLight
            });
        }