public void AddCoin()
        {
            int originalCount = testCoinBank.Coins[5];

            testCoinBank.AddCoin(5);
            Assert.AreEqual(originalCount + 1, testCoinBank.Coins[5]);
        }
示例#2
0
        public void ComplexCase()
        {
            // Arrange
            var bank = new CoinBank();

            bank.AddCoin(CoinDenomination.TwentyPence);

            bank.AddCoin(CoinDenomination.FiftyPence);
            bank.AddCoin(CoinDenomination.TwentyPence);
            bank.AddCoin(CoinDenomination.TenPence);

            // Act
            bank.Withdraw(0.80M);

            // Assert
            Assert.AreEqual(0.20M, bank.Balance);
        }