Exemplo n.º 1
0
        public void Loan_Amount_Should_Be_Between_1000_And_15000()
        {
            decimal loan = 999m;
            var validator = new LoanAmountValidator(999);
            bool result = validator.Validate();

            Assert.That(result, Is.False);
        }
        public void throw_an_exception_if_loan_amount_is_not_range_or_within_increments(string loan)
        {
            var loanAmountValidator = new LoanAmountValidator(1000m, 15000m, 100m);

            Action action = () => loanAmountValidator.Validate(loan);

            action.ShouldThrow <InputParameterValidationException>();
        }
        public void throw_an_exception_if_loan_amount_is_not_in_numeric_format(string loan)
        {
            var loanAmountValidator = new LoanAmountValidator(1000m, 15000m, 100m);

            Action action = () => loanAmountValidator.Validate(loan);

            action.ShouldThrow <InputParameterValidationException>();
        }
        public void validate_if_loan_amount_is_in_range_and_within_increments(string loan)
        {
            var loanAmountValidator = new LoanAmountValidator(1000m, 15000m, 100m);

            Action action = () => loanAmountValidator.Validate(loan);

            action.ShouldNotThrow();
        }
Exemplo n.º 5
0
 private static bool ValidateRequestedAmount(double requestedAmount)
 {
     IValidator validator = new LoanAmountValidator(requestedAmount);
     bool result = validator.Validate();
     if (!result)
     {
         Console.WriteLine("Please enter the loan amount between £1000 and £15000.");
         return true;
     }
     return false;
 }