UnregisterCommand() public method

Unregisters a command with the specified command name.
The is null or whitespace. The is null. The specified command is not created using the method.
public UnregisterCommand ( string commandName, ICommand command ) : void
commandName string Name of the command.
command ICommand The command.
return void
Esempio n. 1
0
            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);
            }