public void RegisteringSameCommandTwiceOverwritesIt() { var exitTrigger = new MockTrigger(); Command.Register("Exit", exitTrigger); Command.Register("Exit", exitTrigger); }
public void CreateCommandWithManualTrigger() { customTrigger = new MockTrigger(); new Command(() => pos += Time.Delta).Add(customTrigger); InvokingTriggerWithoutRunningEntitiesDoesNotCauseAction(); InvokingTriggerOnceWithMultipleRunsOnlyCausesOneAction(); }
public void InvokeOnTrigger() { customTrigger = new MockTrigger(); customTrigger.Invoked = () => { customTrigger.UpdatePriority = Priority.Normal; }; customTrigger.Invoke(); Assert.AreEqual(customTrigger.UpdatePriority, Priority.Normal); Assert.IsFalse(customTrigger.IsPauseable); }
public void CommandWithPositionctionMock() { var trigger = new MockTrigger(); var commandName = RegisterCommand(trigger); new Command(commandName, delegate(Vector2D point) { actionPerformed = true; }); AssertActionPerformed(trigger); }
public void CommandWithZoomActionMock() { var trigger = new MockTrigger(); const string CommandName = "PositionActionCommand"; Command.Register(CommandName, trigger); actionPerformed = false; new Command(CommandName, delegate(float zoom) { actionPerformed = true; }); AssertActionPerformed(trigger); }
public void RegisterCommandWithSeveralTriggers() { const string CommandName = "CommandWithSeveralTriggers"; var trigger1 = new MockTrigger(); var trigger2 = new MockTrigger(); Command.Register(CommandName, trigger1, trigger2); var command = new Command(CommandName, (Action)null); Assert.AreEqual(2, command.GetTriggers().Count); }