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); } } }
public void Dispense() { Console.WriteLine("SS: Dispensing"); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { _gumballMachine.SetState(_gumballMachine.SoldOutState); } }