public void ReturnsTrueForCreatedCommand() { var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); Assert.IsTrue(commandManager.IsCommandCreated("MyCommand")); }
public void CorrectlyCreatesTheCommand() { var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); Assert.IsTrue(commandManager.IsCommandCreated("MyCommand")); }
public void ThrowsInvalidOperationExceptionForAlreadyCreatedCommand() { var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); ExceptionTester.CallMethodAndExpectException<InvalidOperationException>(() => commandManager.CreateCommand("MyCommand")); }
public void ThrowsArgumentNullExceptionForNullCommandName() { var commandManager = new CommandManager(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => commandManager.GetCommand(null)); }
public void ReturnsFalseForNotCreatedCommand() { var commandManager = new CommandManager(); Assert.IsFalse(commandManager.IsCommandCreated("MyCommand")); }
public void ThrowsArgumentNullExceptionForWhitespaceCommandName() { var commandManager = new CommandManager(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => commandManager.IsCommandCreated(" ")); }
public void ThrowsArgumentNullExceptionForNullCommand() { var vm = new CompositeCommandViewModel(); var commandManager = new CommandManager(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => commandManager.RegisterCommand("MyCommand", null)); }
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 ThrowsArgumentNullExceptionForWhitespaceCommandName() { var vm = new CompositeCommandViewModel(); var commandManager = new CommandManager(); ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => commandManager.RegisterCommand(" ", vm.TestCommand1)); }
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 ReturnsCommandForCreatedCommand() { var commandManager = new CommandManager(); commandManager.CreateCommand("MyCommand"); Assert.IsNotNull(commandManager.GetCommand("MyCommand")); }
public void ReturnsNullForNotCreatedCommand() { var commandManager = new CommandManager(); Assert.IsNull(commandManager.GetCommand("MyCommand")); }
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 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); }