public void IsDueInHour_Test(string cron, string moment, bool expected) { var sut = new JobRegistration("key1", cron); var fromUtc = GetDateTime(moment); sut.IsDue(fromUtc.UtcDateTime, TimeSpan.FromHours(1)).ShouldBe(expected); }
void ExecuteFromCommand() { Job = new JobRegistration { Emploee = Employee.Model, JobStart = DateTime.Now }; TimeSheet = $"{Job.Emploee.FirstName} - {Job.Emploee.LastName} od: {Job.JobStart}"; }
public JobSchedulerOptions Register(JobRegistration registration, IJob job) { EnsureArg.IsNotNull(registration, nameof(registration)); EnsureArg.IsNotNull(job, nameof(job)); registration.Key ??= HashAlgorithm.ComputeHash(job); this.logger.LogInformation($"{{LogKey:l}} registration (key={{JobKey}}, cron={registration.Cron}, isReentrant={registration.IsReentrant}, timeout={registration.Timeout:c}, enabled={registration.Enabled})", LogKeys.JobScheduling, registration.Key); var item = this.Registrations.FirstOrDefault(r => r.Key.Key.SafeEquals(registration.Key)); if (item.Key != null) { this.Registrations.Remove(item.Key); } this.Registrations.Add(registration, job); return(this); }
public void AddJobRegistration(JobRegistration jobRegistration) { _context.Attach(jobRegistration); _context.SaveChanges(); }