Exemplo n.º 1
0
        public void Dispense()
        {
            Console.WriteLine("WS: WINNER!");

            _gumballMachine.ReleaseBall();

            if (_gumballMachine.Count == 0)
            {
                _gumballMachine.SetState(_gumballMachine.SoldOutState);
            }
            else
            {
                _gumballMachine.ReleaseBall();

                if (_gumballMachine.Count == 0)
                {
                    _gumballMachine.SetState(_gumballMachine.SoldOutState);
                }
                else
                {
                    _gumballMachine.SetState(_gumballMachine.NoQuarterState);
                }
            }
        }
Exemplo n.º 2
0
        public void Dispense()
        {
            Console.WriteLine("SS: Dispensing");

            _gumballMachine.ReleaseBall();

            if (_gumballMachine.Count > 0)
            {
                _gumballMachine.SetState(_gumballMachine.NoQuarterState);
            }
            else
            {
                _gumballMachine.SetState(_gumballMachine.SoldOutState);
            }
        }