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();
            }
        }
Exemple #2
0
        public void DispenseWhenSoldOut()
        {
            GumballMachine gumballMachine = CreateGumballMachine(NO_GUMBALLS);

            gumballMachine.Dispense();

            this.AssertMachineMessage(MachineMessages.DispenseWhenSoldOut);
        }
Exemple #3
0
        public void DispenseWhenNoQuarter()
        {
            GumballMachine gumballMachine = CreateGumballMachine(1);

            gumballMachine.Dispense();

            this.AssertMachineMessage(MachineMessages.DispenseWhenNoQuarter);
        }