Example #1
0
        /// <summary>
        /// Builds summary string from constituent parts
        /// </summary>
        /// <param name="ruleSet"><c>IRuleSet</c> will determine what rules are to be applied to the flight</param>
        private string BuildSummaryString(IRuleSet ruleSet)
        {
            StringBuilder result = new StringBuilder();

            if (Passengers.Count > Aircraft.NumberOfSeats)
            {
                OtherAircraft(ref result);

                return(result.ToString());
            }

            result.Append("Flight summary for ");
            result.Append(FlightRoute.Title);

            AddVerticalWhiteSpace(ref result);

            AddPassengersDetails(ref result);

            AddVerticalWhiteSpace(ref result);

            AddCostInfo(ref result);

            AddVerticalWhiteSpace(ref result);

            AddLoyaltyInfo(ref result);

            AddVerticalWhiteSpace(ref result);

            if (ruleSet.CanProceed())
            {
                result.Append("THIS FLIGHT MAY PROCEED");
            }
            else
            {
                result.Append("FLIGHT MAY NOT PROCEED");
            }
            return(result.ToString());
        }