public void PayEqualPriceThenNoChange(int price, int amount)
        {
            var sut    = new ChangeCalculator();
            var result = sut.CalChange(price, amount);

            Assert.Equal(0, result.ChangeAmount);
            var expected = new[] { 0, 0, 0, 0, 0, 0, 0 };

            Assert.Equal(expected, result.ChangeBanks);
        }
        public void PayMoreThanPriceThenReturnChange(int price, int amount, int expectedChange, int thousand, int fiveHundred, int hundred, int fifty, int twenty, int five, int one)
        {
            var sut    = new ChangeCalculator();
            var result = sut.CalChange(price, amount);

            Assert.Equal(expectedChange, result.ChangeAmount);
            var expected = new[]
            {
                thousand,
                fiveHundred,
                hundred,
                fifty,
                twenty,
                five,
                one
            };

            Assert.Equal(expected, result.ChangeBanks);
        }
Example #3
0
        public ActionResult <ChangeResult> Get(int price, int amount)
        {
            var change = new ChangeCalculator();

            return(change.CalChange(price, amount));
        }