コード例 #1
0
        public void AccountCantHaveLess100_ItWas0ThenWithdraw100_ShouldReturnError()
        {
            // ARRANGE
            var transaction = BankService.CreateTransaction(TransactionType.Withdraw, Account, 100m);

            // ACT
            var rule = new AccountCantHaveLess100(transaction);
            var canExecute = rule.CanExecuteTransaction();
            var errors = rule.GetErrors();

            // ASSERT
            Assert.AreEqual(false, canExecute);
            Assert.AreEqual(1, errors.Count());
        }
コード例 #2
0
        public void AccountCantHaveLess100_ItWas0ThenDeposit150_ShouldNotReturnError()
        {
            // ARRANGE
            var transaction = BankService.CreateTransaction(TransactionType.Deposit, Account, 150m);

            // ACT
            var rule = new AccountCantHaveLess100(transaction);
            var canExecute = rule.CanExecuteTransaction();
            var errors = rule.GetErrors();

            // ASSERT
            Assert.AreEqual(true, canExecute);
            Assert.AreEqual(0, errors.Count());
        }