예제 #1
0
        public void RegisteringSameCommandTwiceOverwritesIt()
        {
            var exitTrigger = new MockTrigger();

            Command.Register("Exit", exitTrigger);
            Command.Register("Exit", exitTrigger);
        }
예제 #2
0
 public void CreateCommandWithManualTrigger()
 {
     customTrigger          = new MockTrigger();
     new Command(() => pos += Time.Delta).Add(customTrigger);
     InvokingTriggerWithoutRunningEntitiesDoesNotCauseAction();
     InvokingTriggerOnceWithMultipleRunsOnlyCausesOneAction();
 }
예제 #3
0
 public void InvokeOnTrigger()
 {
     customTrigger         = new MockTrigger();
     customTrigger.Invoked = () => { customTrigger.UpdatePriority = Priority.Normal; };
     customTrigger.Invoke();
     Assert.AreEqual(customTrigger.UpdatePriority, Priority.Normal);
     Assert.IsFalse(customTrigger.IsPauseable);
 }
예제 #4
0
        public void CommandWithPositionctionMock()
        {
            var trigger     = new MockTrigger();
            var commandName = RegisterCommand(trigger);

            new Command(commandName, delegate(Vector2D point) { actionPerformed = true; });
            AssertActionPerformed(trigger);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }