Beispiel #1
0
 public void Dispense()
 {
     _gumbalMachineContext.ReleaseBall();
     if (_gumbalMachineContext.BallsCount == 0)
     {
         Console.WriteLine("Oops, out of gumbals");
         _gumbalMachineContext.SetSoldOutState();
     }
     else if (_gumbalMachineContext.QuartersCount == 0)
     {
         _gumbalMachineContext.SetNoQuarterState();
     }
     else
     {
         _gumbalMachineContext.SetHasQuarterState();
     }
 }
Beispiel #2
0
 public void InsertQuarter()
 {
     Console.WriteLine("You inserted a quarter");
     ++_gumbalMachineContext.QuartersCount;
     _gumbalMachineContext.SetHasQuarterState();
 }