public void WrongDenominationsSetTest() { var coinBox = new CoinsBox(); coinBox.RegisterDenomination(50, 10, 5); coinBox.LoadCoins(50, 100); coinBox.LoadCoins(5, 100); coinBox.LoadCoins(10, 100); SortedList <int, int> change; Assert.IsFalse(coinBox.TryGetChange(104, out change)); Assert.AreEqual(0, change.Count); }
public void ChangeIsNotAvailableTest() { var coinBox = new CoinsBox(); coinBox.RegisterDenomination(50, 10, 5, 2, 1); coinBox.LoadCoins(50, 10); coinBox.LoadCoins(5, 10); coinBox.LoadCoins(10, 10); SortedList <int, int> change; Assert.IsFalse(coinBox.TryGetChange(1040, out change)); Assert.AreEqual(0, change.Count); }
public void GiveChangeTest104() { var coinBox = new CoinsBox(); coinBox.RegisterDenomination(50, 10, 2, 5, 1); coinBox.LoadCoins(50, 100); coinBox.LoadCoins(5, 100); coinBox.LoadCoins(10, 100); coinBox.LoadCoins(2, 100); coinBox.LoadCoins(1, 100); SortedList <int, int> change; Assert.IsTrue(coinBox.TryGetChange(104, out change)); Assert.AreEqual(2, change.Count); Assert.AreEqual(2, change[50]); Assert.AreEqual(2, change[2]); }