Exemple #1
0
		public void CreateCommandWithManualTrigger()
		{
			customTrigger = new MockTrigger();
			new Command(() => pos += Time.Delta).Add(customTrigger);
			InvokingTriggerWithoutRunningEntitiesDoesNotCauseAction();
			InvokingTriggerOnceWithMultipleRunsOnlyCausesOneAction();
		}
Exemple #2
0
 public void CommandWithPositionctionMock()
 {
     var trigger = new MockTrigger();
     var CommandName = RegisterCommand(trigger);
     new Command(CommandName, delegate(Vector2D point) { actionPerformed = true; });
     AssertActionPerformed(trigger);
 }
Exemple #3
0
		public void RegisteringSameCommandTwiceOverwritesIt()
		{
			var exitTrigger = new MockTrigger();
			Command.Register("Exit", exitTrigger);
			Command.Register("Exit", exitTrigger);
		}
Exemple #4
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);
		}
Exemple #5
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);
		}
Exemple #6
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);
		}
Exemple #7
0
		public void CommandWithDragActionMock()
		{
			var trigger = new MockTrigger();
			var commandName = RegisterCommand(trigger);
			new Command(commandName, delegate(Vector2D point, Vector2D dims, bool test)
				{ actionPerformed = true; });
			AssertActionPerformed(trigger);
		}