// Makes sure we can actually calculate a payment:
        // - The amortization period enum is valid
        // - The down payment is big enough
        // - The mortgage period is valid
        private void Validate()
        {
            // Make sure the amortization period enum is valid
            if (!ValidatePaymentScheduleOptions.Validate(this.PaymentSchedule))
            {
                throw new Exception("Invalid PaymentSchedule. Valid values are monthly, biweekly, weekly");
            }

            // Make sure the mortgage period is valid (not less than 5 years, not more than 25)
            if (!ValidateValidMortgageLength.Validate(this.AmortizationPeriod, this.PaymentSchedule))
            {
                throw new Exception("Invalid AmortizationPeriod - Must be more than 5 years, less than 25");
            }
        }
Ejemplo n.º 2
0
        // Makes sure we can actually calculate a payment:
        // - The amortization period enum is valid
        // - The down payment is big enough
        // - The mortgage period is valid
        private void Validate()
        {
            // Make sure the amortization period enum is valid
            if (!ValidatePaymentScheduleOptions.Validate(this.PaymentSchedule))
            {
                throw new Exception("Invalid PaymentSchedule. Valid values are monthly, biweekly, weekly");
            }

            // Make sure the down payment is big enough
            if (!ValidateDownPaymentLargeEnough.Validate(this.AskingPrice, this.DownPayment))
            {
                throw new Exception("Downpayment is insufficent for the AskingPrice.");
            }

            // Make sure the mortgage period is valid (not less than 5 years, not more than 25)
            if (!ValidateValidMortgageLength.Validate(this.AmortizationPeriod, this.PaymentSchedule))
            {
                throw new Exception("Invalid AmortizationPeriod - Must be more than 5 years, less than 25");
            }
        }