public bool IsAdjustedRevenueWithinCostOfFlight_EnsureFlightProfitability(decimal totalRevenue, decimal totalCostOfFlightToAirline, decimal discountedAmountForPassengersOnFlight) { _cashFlowCalculationServiceMock.Setup(ccs => ccs.CalculateTotalRevenueFromPayingCustomers()).Returns(totalRevenue); _cashFlowCalculationServiceMock.Setup(ccs => ccs.CalculateTotalCostOfFlightToAirline()).Returns(totalCostOfFlightToAirline); _cashFlowCalculationServiceMock.Setup(ccs => ccs.CalculateDiscountedAmountForPassengersOnFlight()).Returns(discountedAmountForPassengersOnFlight); var isAdjustedRevenueWithinCost = _flightValidationService.IsAdjustedRevenueWithinCostOfFlight(); return(isAdjustedRevenueWithinCost); }
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 }); }