public void trigger_is_cached_by_key() { CommandTriggerMap subject = new CommandTriggerMap(stubby.KeyFactory, stubby.TriggerFactory); object mapper1 = subject.GetTrigger("hi", 5); object mapper2 = subject.GetTrigger("hi", 5); Assert.That(mapper1, Is.Not.Null); Assert.That(mapper1, Is.EqualTo(mapper2)); }
public void removeTrigger_deactivates_trigger() { host.Setup (h => h.TriggerFactory (It.IsAny<object[]>())).Returns (trigger.Object); trigger.Setup (t => t.Deactivate ()); CommandTriggerMap subject = new CommandTriggerMap (stubby.KeyFactory, host.Object.TriggerFactory); subject.GetTrigger("hi", 5); subject.RemoveTrigger("hi", 5); trigger.Verify (t => t.Deactivate (), Times.Once); }
public void removeTrigger_deactivates_trigger() { host.Setup(h => h.TriggerFactory(It.IsAny <object[]>())).Returns(trigger.Object); trigger.Setup(t => t.Deactivate()); CommandTriggerMap subject = new CommandTriggerMap(stubby.KeyFactory, host.Object.TriggerFactory); subject.GetTrigger("hi", 5); subject.RemoveTrigger("hi", 5); trigger.Verify(t => t.Deactivate(), Times.Once); }