public void IntegrationCompletedCallsInnerTrigger() { 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(); mocks.VerifyAll(); }
public void NextBuildReturnsNextAllowedTimeForTimeRollUp() { var innerTrigger = this.mocks.StrictMock<ITrigger>(); Expect.Call(() => { innerTrigger.IntegrationCompleted(); }); var trigger = new RollUpTrigger(); trigger.InnerTrigger = innerTrigger; trigger.MinimumTime = new Timeout(10, TimeUnits.MINUTES); mocks.ReplayAll(); trigger.IntegrationCompleted(); Assert.Greater(trigger.NextBuild, DateTime.Now.AddMinutes(9)); mocks.VerifyAll(); }
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 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(); }