public void ThrowsArgumentNullExceptionForNullAction() { var compositeCommand = new CompositeCommand(); ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => compositeCommand.UnregisterAction((Action<object>)null)); }
public void RegisteredActionsCanBeUnregistered_DynamicAction() { var compositeCommand = new CompositeCommand(); compositeCommand.RegisterAction(RegisteredActionsCanBeUnregistered_TestMethod); compositeCommand.UnregisterAction(RegisteredActionsCanBeUnregistered_TestMethod); compositeCommand.Execute(null); Assert.IsFalse(_registeredActionsCanBeUnregistered_TestValue); }
public void UnregistersCommandForExecution() { var compositeCommand = new CompositeCommand(); bool executed = false; var action = new Action<object>(obj => executed = true); compositeCommand.RegisterAction(action); compositeCommand.UnregisterAction(action); compositeCommand.Execute(); Assert.IsFalse(executed); }
public void RegisteredActionsCanBeUnregistered_DefinedAction() { var invoked = false; Action action = () => invoked = true; var compositeCommand = new CompositeCommand(); compositeCommand.RegisterAction(action); compositeCommand.UnregisterAction(action); compositeCommand.Execute(null); Assert.IsFalse(invoked); }