public void FireFiresAfterTimePeriodHasExpired() { var innerTrigger = this.mocks.StrictMock<ITrigger>(); Expect.Call(() => { innerTrigger.IntegrationCompleted(); }); var expected = new IntegrationRequest(BuildCondition.IfModificationExists, "Test", null); Expect.Call(innerTrigger.Fire()).Return(expected); var clock = new TestClock { Now = DateTime.Now }; var trigger = new RollUpTrigger(clock); trigger.MinimumTime = new Timeout(10, TimeUnits.MINUTES); trigger.InnerTrigger = innerTrigger; mocks.ReplayAll(); trigger.IntegrationCompleted(); clock.TimePasses(new TimeSpan(0, 11, 0)); var actual = trigger.Fire(); Assert.AreSame(expected, actual); mocks.VerifyAll(); }
public void FireDoesNotFireWithoutInnerTrigger() { var innerTrigger = this.mocks.StrictMock<ITrigger>(); Expect.Call(innerTrigger.Fire()) .Return(null); var trigger = new RollUpTrigger(); trigger.MinimumTime = new Timeout(10, TimeUnits.MINUTES); trigger.InnerTrigger = innerTrigger; mocks.ReplayAll(); Assert.IsNull(trigger.Fire()); mocks.VerifyAll(); }
public void FireDoesNotFireBeforeTimePeriodHasExpired() { var innerTrigger = this.mocks.StrictMock<ITrigger>(); Expect.Call(() => { innerTrigger.IntegrationCompleted(); }); var trigger = new RollUpTrigger(); trigger.MinimumTime = new Timeout(10, TimeUnits.MINUTES); trigger.InnerTrigger = innerTrigger; mocks.ReplayAll(); trigger.IntegrationCompleted(); Assert.IsNull(trigger.Fire()); mocks.VerifyAll(); }