Пример #1
0
        public void Run_new_job()
        {
            Close();

            runner.DefaultInterval = TimeSpan.Zero;
            runner.Run();

            Reopen();
            var activeRecordJob = GetJob();

            Assert.That(activeRecordJob, Is.Not.Null);
            Assert.That(activeRecordJob.LastRun, Is.EqualTo(DateTime.Now).Within(2).Seconds);
            Assert.That(activeRecordJob.NextRun, Is.EqualTo(DateTime.Today));
            Assert.That(activeRecordJob.RunInterval, Is.EqualTo(TimeSpan.Zero));
            job.AssertWasCalled(j => j.Work());

            var logs = ActiveRecordLinqBase <JobLog> .Queryable.Where(l => l.Name == name).ToList();

            Assert.That(logs.Count, Is.EqualTo(1));
        }