Пример #1
0
        public static void Test()
        {
            var context    = new Context();
            var startState = new StartState();

            startState.DoAction(context);
            Console.WriteLine(context.GetState());
            var stopState = new StopState();

            stopState.DoAction(context);
            Console.WriteLine(context.GetState());
        }
Пример #2
0
        static void Main(string[] args)
        {
            Context context = new Context();

            StartState startState = new StartState();

            startState.doAction(context);

            Console.WriteLine(context.getState().ToString());

            StopState stopState = new StopState();

            stopState.doAction(context);

            Console.WriteLine(context.getState().ToString());

            Console.ReadKey();
        }