コード例 #1
0
        public void Withdraw_NoValidatedCustomer_ReturnsInvalidResult()
        {
            //arrange
            var atm = Atm.Load(8000.0m);
            //act
            var result = atm.Withdraw(200.0m);

            //assert
            Assert.Equal(TransactionOutcome.Failure, result.Result);
            Assert.Equal("ACCOUNT_ERR", result.FailureMessage);
        }
コード例 #2
0
        public void Withdraw_ValidAmount_ReturnsValidResult()
        {
            //arrange
            var atm = Atm.Load(8000.0m);

            atm.SetCurrentCustomer(DefaultAccount());
            //act
            var result = atm.Withdraw(200.0m);

            //assert
            Assert.Equal(TransactionOutcome.Success, result.Result);
            Assert.Equal(7800.0m, result.Balance);
            Assert.Equal(7800.0m, atm.Balance);
        }
コード例 #3
0
        public void Withdraw_ExceedBalance_ReturnsInvalidResult()
        {
            //arrange
            var atm = Atm.Load(8000.0m);

            atm.SetCurrentCustomer(DefaultAccount());
            //act
            var result = atm.Withdraw(8001.0m);

            //assert
            Assert.Equal(TransactionOutcome.Failure, result.Result);
            Assert.Equal(8000.0m, result.Balance);
            Assert.Equal(8000.0m, atm.Balance);
            Assert.Equal("ATM_ERR", result.FailureMessage);
        }
コード例 #4
0
 public Atm Get()
 {
     return(Atm.Load(8000));
 }