예제 #1
0
        public void TransferFunds(Account destination, decimal amount)
        {
            destination.Deposit(amount);

            if(amount > 1000)
                throw new Exception("aaa");

            this.Withdraw(amount);
        }
예제 #2
0
        public void Deposit_PositiveValue_ShouldAddToBalance()
        {
            // Arrange
            account = new Account();

            // Act
            account.Deposit(100);

            // Assert
            Assert.AreEqual(100, account.Balance);
        }
예제 #3
0
        public void TransferFunds_WhenHaveFunds_ShouldTransfer()
        {
            // AAA

               // Arrange
               var  src = new Account();
            src.Deposit(200);

            var dst = new Account();
            dst.Deposit(100);

            // Act
            src.TransferFunds(dst, 100);

            // Assert
            Assert.AreEqual(200, dst.Balance);
            Assert.AreEqual(100, src.Balance);
        }
예제 #4
0
        public void TransferFunds_WhenNoFunds_ShouldThrowsException()
        {
            Account source = new Account();
            source.Deposit(150m);

            Account destination = new Account();
            destination.Deposit(200m);

            //source.TransferFunds(destination, 200);

            Assert.Throws<Exception>(() =>  source.TransferFunds(destination, 200));

            Assert.AreEqual(150m, source.Balance);
            Assert.AreEqual(400m, destination.Balance);
        }
예제 #5
0
 public void SetUp()
 {
     // Uruchamia się przed każdym testem
     // Inicjalizacja Ninjecta, Sesji itp.
     account = new Account();
 }
예제 #6
0
        public void TransferFunds_WhenTransfer1000_ShouldThrowsException()
        {
            Account source = new Account();
            source.Deposit(2000);
            Account destination = new Account();

            Assert.Throws<Exception>(() => source.TransferFunds(destination, 1500));
        }