public void StateTest() { { var c = new 状态模式.基本.Context(); c.Request(); c.Request(); c.Request(); } { var mach = new GumballMachine(); mach.InsertQuarter(); mach.TurnCrank(); mach.Dispense(); mach.Dispense(); mach.Dispense(); mach.Print(); mach.InsertQuarter(); mach.TurnCrank(); mach.Dispense(); mach.Print(); } }
public void DispenseWhenSoldOut() { GumballMachine gumballMachine = CreateGumballMachine(NO_GUMBALLS); gumballMachine.Dispense(); this.AssertMachineMessage(MachineMessages.DispenseWhenSoldOut); }
public void DispenseWhenNoQuarter() { GumballMachine gumballMachine = CreateGumballMachine(1); gumballMachine.Dispense(); this.AssertMachineMessage(MachineMessages.DispenseWhenNoQuarter); }