public void Should_run_every_scheduled_second_without_providing_instance() { var scheduler = new DefaultSchedulerFactory().Create(); scheduler.Setup( Job.Run<TestJob>(x => x.RunJob()).Every(1.Second()) ).Start(); Thread.Sleep(TimeSpan.FromSeconds(5)); scheduler.Stop(); Assert.That(TestJob.TimesCalled, Is.EqualTo(5)); }
public void Should_run_every_scheduled_second() { var container = new WindsorContainer(); var testJob = new TestJob(); container.Register(Component.For<TestJob>().Instance(testJob)); var scheduler = new DefaultSchedulerFactory().UseContainer(() => new WindsorServiceLocator(container)).Create(); scheduler.Setup( Job.Run<TestJob>(x => x.RunJob()).Every(1.Second()) ).Start(); Thread.Sleep(TimeSpan.FromSeconds(5)); scheduler.Stop(); Assert.That(testJob.TimesCalled, Is.EqualTo(5)); container.Dispose(); }