public ExecuteCommand ( string commandName ) : void | ||
commandName | string | Name of the command. |
return | void |
public void DoesNotExecuteUnregisteredCommands() { var vm = new CompositeCommandViewModel(); var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); commandManager.RegisterCommand("MyCommand", vm.TestCommand1); Assert.IsTrue(commandManager.IsCommandCreated("MyCommand")); commandManager.UnregisterCommand("MyCommand", vm.TestCommand1); commandManager.ExecuteCommand("MyCommand"); Assert.IsFalse(vm.IsTestCommand1Executed); }
public void ExecutesRegisteredCommands() { var vm = new CompositeCommandViewModel(); var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); commandManager.RegisterCommand("MyCommand", vm.TestCommand1); commandManager.ExecuteCommand("MyCommand"); Assert.IsTrue(vm.IsTestCommand1Executed); }
public void RegisteredActionsCanBeUnregistered_DynamicAction() { var commandManager = new CommandManager(); commandManager.CreateCommand("TestAction"); commandManager.RegisterAction("TestAction", RegisteredActionsCanBeUnregistered_TestMethod); commandManager.UnregisterAction("TestAction", RegisteredActionsCanBeUnregistered_TestMethod); commandManager.ExecuteCommand("TestAction"); Assert.IsFalse(_registeredActionsCanBeUnregistered_TestValue); }
public void ThrowsArgumentNullExceptionForWhitespaceCommandName() { var commandManager = new CommandManager(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => commandManager.ExecuteCommand(" ")); }
public void RegisteredActionsCanBeUnregistered_DefinedAction() { var invoked = false; Action action = () => invoked = true; var commandManager = new CommandManager(); commandManager.CreateCommand("TestAction"); commandManager.RegisterAction("TestAction", action); commandManager.UnregisterAction("TestAction", action); commandManager.ExecuteCommand("TestAction"); Assert.IsFalse(invoked); }