コード例 #1
0
        public void Should_return_true_by_default()
        {
            // Arrange
            var credit = new Credit(1, 1);
            var su     = new CreditValidator(new List <ICreditValidation>());
            // Act
            var result = su.Validate(_customer, credit);

            // Assert
            Assert.IsTrue(result);
        }
コード例 #2
0
        public void Should_return_true_when_customer_salary_is_enough()
        {
            // Arrange
            _customer.Salary = 1000;
            var credit = new Credit(10000, 15);
            var su     = new CreditValidator(new List <ICreditValidation>
            {
                new SalaryValidationRule(1)
            });
            // Act
            var result = su.Validate(_customer, credit);

            // Assert
            Assert.IsTrue(result);
        }
コード例 #3
0
        public void Should_return_false_when_customer_balance_is_not_enough()
        {
            // Arrange
            _customer.Balance = 1000;
            var credit = new Credit(10000, 1);
            var su     = new CreditValidator(new List <ICreditValidation>
            {
                new BalanceValidationRule(10)
            });
            // Act
            var result = su.Validate(_customer, credit);

            // Assert
            Assert.IsFalse(result);
        }