Пример #1
0
        public void EjectQuarter_MachineWithoutQuarter_NothingHapenned()
        {
            // Arrange
            _testOutputHelper.WriteLine(_gumballMachine.ToString() + "\n-----------");

            // Act
            _gumballMachine.EjectQuarter();

            // Assert
            Assert.Equal(0u, _gumballMachine.QuartersCount);
            Assert.Equal(0u, _gumballMachine.BallsCount);
            _testOutputHelper.WriteLine(_gumballMachine.ToString() + "\n-----------");
        }
Пример #2
0
        public Menu GetSetuped()
        {
            Menu menu = new Menu();

            menu.AddItem(
                shortcut: "Help",
                description: "Print <Help> to show command info",
                (arguments) => Console.WriteLine(menu.GetCommandsInfo())
                );

            menu.AddItem(
                shortcut: "BallsCount",
                description: "Print <BallsCount> to show gumbles count in the machine",
                (args) => Console.WriteLine($"Balls count: {_machine.BallsCount}")
                );

            menu.AddItem(
                shortcut: "QuartersCount",
                description: "Print <QuartersCount> to show quarters count in the machine",
                (args) => Console.WriteLine($"Quarters count: {_machine.QuartersCount}")
                );

            menu.AddItem(
                shortcut: "MaxQuartersCount",
                description: "Print <MaxQuartersCount> to show max quarters count in the machine",
                (args) => Console.WriteLine($"Max quarters count: {_machine.MaxQuartersCount}")
                );

            menu.AddItem(
                shortcut: "InsertQuarter",
                description: "Print <InsertQuarter> to insert quarter into the machine",
                (args) => _machine.InsertQuarter()
                );

            menu.AddItem(
                shortcut: "EjectQuarter",
                description: "Print <EjectQuarter> to eject quarter from the machine",
                (args) => _machine.EjectQuarter()
                );

            menu.AddItem(
                shortcut: "TurnCrank",
                description: "Print <TurnCrank> to turn crank at the machine",
                (args) => _machine.TurnCrank()
                );

            menu.AddItem(
                shortcut: "AddBalls",
                description: "Print <AddBalls> <BallsCount> to add balls at the machine",
                AddBalls
                );

            menu.AddItem(
                shortcut: "MachineInfo",
                description: "Print <MachineInfo> to know the details of the machine",
                (args) => Console.WriteLine(_machine.ToString())
                );

            return(menu);
        }