public void ChangeForCoinIsACoin(int coin)
        {
            CalculateChange calculateChange;
            IList<int> result;

            Scenario()
                .Given(calculateChange = new CalculateChange())

                .When(result = calculateChange.ChangeFor(coin))

                .Then(result, Is(AList.InOrder().WithOnlyValues(coin)));
        }
        public void GivesChangeStartingFromLargestPossibleCoin(int amount, int[] coins)
        {
            CalculateChange calculateChange;
            IList<int> result;

            Scenario()
                .Given(calculateChange = new CalculateChange())

                .When(result = calculateChange.ChangeFor(amount))

                .Then(result, Is(AList.InOrder().WithOnlyValues(coins)));
        }
        public void ChangeForZeroIsEmpty()
        {
            CalculateChange calculateChange;
            IList<int> result;

            Scenario()
                .Given(calculateChange = new CalculateChange())

                .When(result = calculateChange.ChangeFor(0))

                .Then(result, Is(AList.NoItems<int>()));
        }
Пример #4
0
        public void DisplayMenu()
        {
            getProductList    = new GetProductList(fileRepo);
            updateVendingRepo = new UpdateVendingRepo(fileRepo);

            AsciiArt();
            Console.WriteLine();
            new CalculateChange(ConsoleIO.ReadDecimailInRange("How Much money do you want to put into the vending machine: ", 0, 100));

            int selection = 0;

            do
            {
                Console.Clear();
                Dictionary <string, VendingItem> products = getProductList.GetProducts();
                AsciiArt();

                Console.WriteLine();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine($"Current Money: ${CalculateChange.Money}");
                Console.ResetColor();
                selection = ConsoleIO.SelectFromMenu();
                switch (selection)
                {
                case 1:
                    CalculateChange.AddMoney();
                    break;

                case 2:
                    Console.Clear();
                    AsciiArt();
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine($"Current Money: ${CalculateChange.Money}");
                    Console.ResetColor();
                    updateVendingRepo.UpdateVending();
                    break;
                }
            } while (selection > 0 && selection < 3);

            Console.Clear();
            Console.WriteLine("GOODBYE!");
            Console.ReadKey();
        }