コード例 #1
0
ファイル: ValidatorTest.cs プロジェクト: andrewchaa/Qoute
        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);
        }
コード例 #2
0
        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>();
        }
コード例 #3
0
        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>();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: andrewchaa/Qoute
 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;
 }