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

            gumballMachine.Dispense();

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

            gumballMachine.Dispense();

            this.AssertMachineMessage(MachineMessages.DispenseWhenNoQuarter);
        }