public void TestCommandInvoke()
        {
            var memento = new DummyCareTaker();

            memento.Save(new Dummy());

            var commands = new Commands(Assembly.GetAssembly(typeof(CommandTests)));

            commands.AddBinding(TestCommandName, "(AltLeft|AltRight) C");
            commands.AddBinding(HalloCommandName, "(AltLeft|AltRight) T");

            commands.Handle("AltRight", memento);
            commands.Handle("C", memento);

            Assert.IsTrue(commands.HasLastCommand);
            commands.InvokeLast(memento);
            Assert.AreEqual(TestCommandName, memento.Current.Value);

            Assert.IsFalse(commands.Handle("T", memento));
            Assert.AreEqual(TestCommandName, memento.Current.Value);

            commands.Handle("AltLeft", memento);
            commands.Handle("T", memento);
            Assert.IsTrue(commands.HasLastCommand);
            commands.InvokeLast(memento);
            Assert.AreEqual(HalloCommandName, memento.Current.Value);
        }
        public void TestCommandUndoInvoke()
        {
            var careTaker = new DummyCareTaker();

            careTaker.Save(new Dummy());

            var commands = new Commands(Assembly.GetAssembly(typeof(CommandTests)));

            commands.AddBinding(TestCommandName, "(AltLeft|AltRight) C");
            commands.AddBinding(HalloCommandName, "(AltLeft|AltRight) T");

            commands.Handle("AltRight", careTaker);
            commands.Handle("C", careTaker);

            commands.InvokeLast(careTaker);

            commands.Handle("AltRight", careTaker);
            commands.Handle("T", careTaker);

            careTaker.Undo();

            Assert.AreEqual(TestCommandName, careTaker.Current.Value);
        }