Exemplo n.º 1
0
        public void DoesNothingForWater()
        {
            Change cash = new Change();

            cash.Total = 0;

            cash.ChangeCalculator();

            foreach (int i in cash.GiveBackChange)
            {
                Assert.Equal(0, i);
            }
        }
Exemplo n.º 2
0
        public void GivesCorrectChange(double total, double given, double giveBack)
        {
            Change cash = new Change();

            cash.Total       = total;
            cash.givenAmount = given;
            Assert.True(cash.CustomerGive == giveBack);

            cash.ChangeCalculator();
            double[] numbers = new double[] { 100, 50, 20, 10, 5, 2, 1, 1, .5, .25, .1, .05, .01 };
            double   final   = 0;
            int      count   = 0;

            foreach (int i in cash.GiveBackChange)
            {
                final += Math.Round(numbers[count] * i, 2);
                count++;
            }
            Assert.True(Math.Round(final, 2) == giveBack);
            RoundRegister.CashDrawer.ResetDrawer();
        }