public void ValidateLodgingCosts(ILodgingReservation reservation)
        {
            var pricePerPerson = reservation.PricePerPerson;

            if (pricePerPerson < 0)
            {
                throw new LodgingCostException();
            }
        }
        public void ValidateLodgingDestination(ILodgingReservation reservation)
        {
            var destination = reservation.Destination;

            if (string.IsNullOrWhiteSpace(destination))
            {
                throw new InvalidDestinatinationException();
            }
        }
        public void ValidateLodgingVacancy(ILodgingReservation reservation)
        {
            var numberInParty = reservation.Occupants.Count;
            var vacancy       = new LodgingVacancy();

            if (!vacancy.HasVacancy(numberInParty))
            {
                throw new NoVacancyException();
            }
        }
        public void ValidateLodgingReservation(ILodgingReservation reservation)
        {
            var departureDate = reservation.DepartureDate;
            var returnDate    = reservation.ReturnDate;

            if (returnDate.HasValue)
            {
                if (departureDate > returnDate.Value)
                {
                    throw new DateRangeException();
                }
            }
        }
        public int GetAgeDiscountEligibility(ILodgingReservation reservation)
        {
            int?numberOfPayingAge = 0;

            foreach (var hotelOccupant in reservation.Occupants)
            {
                TimeSpan span       = (DateTime.Now - hotelOccupant.DateOfBirth);
                int      ageInYears = (int)(span.Days / 365.25);
                if (ageInYears > 5)
                {
                    numberOfPayingAge = numberOfPayingAge + 1;
                }
            }
            return(numberOfPayingAge.Value);
        }
        public decimal CalculateTotalLodgingFees(ILodgingReservation reservation)
        {
            decimal?totalFees = 0;

            _validation.ValidateLodgingReservation(reservation);
            _validation.ValidateLodgingCosts(reservation);
            _validation.ValidateLodgingDestination(reservation);
            _validation.ValidateLodgingVacancy(reservation);
            if (reservation.FeesPerPerson.HasValue)
            {
                var ageDiscountEligible = GetAgeDiscountEligibility(reservation);
                totalFees = reservation.FeesPerPerson.Value * reservation.Occupants.Count;
                var adjustedFees = reservation.FeesPerPerson.Value * ageDiscountEligible;
            }
            return((decimal)totalFees);
        }