public void WalletAddCashBackError() { Wallet wallet = new Wallet(); Action action = () => { wallet.AddCahsBack(null); }; Assert.ThrowsException <Exception>(action); }
public void WalletAddCashBackSuccess() { Wallet wallet = new Wallet(); int currentBalance = wallet.Balance; var cashback = new List <ICoin>(); cashback.Add(new Coin(1, 2)); cashback.Add(new Coin(2, 1)); cashback.Add(new Coin(5, 1)); cashback.Add(new Coin(10, 1)); wallet.AddCahsBack(cashback); Assert.AreEqual(currentBalance + cashback.Sum(c => c.CoinValue * c.CoinsCount), wallet.Balance); }