public void VendingMachineWalletCashBackSuccess_5_2_2_2() { List <ICoin> coins = new List <ICoin>(); coins.Add(new Coin(10, 10)); coins.Add(new Coin(5, 10)); coins.Add(new Coin(2, 10)); IVendingMachineWallet wallet = new VendingMachineWallet(coins); wallet.AddCoinsFromAcceptor(9, new List <ICoin>() { new Coin(10, 1), new Coin(10, 1) }); var expectedCollection = wallet.GetCashBack().ToList(); expectedCollection = expectedCollection.OrderBy(c => c.CoinValue).ToList(); List <ICoin> actual = new List <ICoin>(); actual.Add(new Coin(5, 1)); actual.Add(new Coin(2, 1)); actual.Add(new Coin(2, 1)); actual.Add(new Coin(2, 1)); actual = actual.OrderBy(c => c.CoinValue).ToList(); Assert.IsTrue(expectedCollection.SequenceEqual(actual, new CoinsComparer())); }
public void VendingMachineWalletCashBackError() { List <ICoin> coins = new List <ICoin>(); coins.Add(new Coin(10, 10)); coins.Add(new Coin(2, 10)); IVendingMachineWallet wallet = new VendingMachineWallet(coins); wallet.AddCoinsFromAcceptor(9, new List <ICoin>() { new Coin(2, 1), }); var expectedCollection = wallet.GetCashBack(); Assert.IsTrue(expectedCollection == null); }