Example #1
0
        public void TestNegtiveAmount()
        {
            Calculator calc = new Calculator(UKMoneyTypes.GetMoneyForUKCurrency());
            Dictionary <MoneyType, decimal> result = calc.CalculateListOfChange(3, 4);

            Assert.True(result.Count == 0);
        }
Example #2
0
        public void TestNoChange()
        {
            List <MoneyType> moneyList             = UKMoneyTypes.GetMoneyForUKCurrency();
            Calculator       calc                  = new Calculator(moneyList);
            Dictionary <MoneyType, decimal> result = calc.CalculateListOfChange(20, 20);

            Assert.True(result.Count == 0);
        }
Example #3
0
        public void Test20andFivePoint5()
        {
            List <MoneyType> moneyList             = UKMoneyTypes.GetMoneyForUKCurrency();
            Calculator       calc                  = new Calculator(moneyList);
            Dictionary <MoneyType, decimal> result = calc.CalculateListOfChange(20, 5.5m);

            Assert.True(result.Count == 3);

            Assert.True(result.ContainsKey(UKMoneyTypes.TenPounds));
            Assert.True(result[UKMoneyTypes.TenPounds] == 1);
            Assert.True(result.ContainsKey(UKMoneyTypes.TwoPounds));
            Assert.True(result[UKMoneyTypes.TwoPounds] == 2);
            Assert.True(result.ContainsKey(UKMoneyTypes.FiftyPennies));
            Assert.True(result[UKMoneyTypes.TenPounds] == 1);
        }