public async Task GetJobByPriority_Ilr_submission() { IContainer container = Registrations(); using (var scope = container.BeginLifetimeScope()) { // Create the schema in the database var options = scope.Resolve <DbContextOptions <JobQueueDataContext> >(); using (var context = new JobQueueDataContext(options)) { context.Database.EnsureCreated(); } var manager = container.Resolve <IJobManager>(); await manager.AddJob(new Job { Priority = 1, Status = JobStatusType.Ready }); await manager.AddJob(new Job { Priority = 2, Status = JobStatusType.Ready }); IEnumerable <Job> result = (await manager.GetJobsByPriorityAsync(100)).ToList(); result.Should().NotBeEmpty(); Job job = result.First(); job.JobId.Should().Be(2); job.JobType.Should().Be(JobType.IlrSubmission); } }
public async Task AddJob_Success_Values(JobType jobType) { var job = new Job { DateTimeSubmittedUtc = DateTime.UtcNow, DateTimeUpdatedUtc = DateTime.UtcNow, JobId = 0, Priority = 1, RowVersion = null, Status = JobStatusType.Ready, SubmittedBy = "test user", JobType = jobType, NotifyEmail = "*****@*****.**" }; IContainer container = Registrations(); Job savedJob; using (var scope = container.BeginLifetimeScope()) { IJobManager manager = scope.Resolve <IJobManager>(); await manager.AddJob(job); var result = await manager.GetAllJobs(); savedJob = result.SingleOrDefault(); } savedJob.Should().NotBeNull(); savedJob.JobId.Should().Be(1); savedJob.DateTimeSubmittedUtc.Should().BeOnOrBefore(DateTime.UtcNow); savedJob.DateTimeUpdatedUtc.Should().BeNull(); savedJob.JobType.Should().Be(jobType); savedJob.Priority.Should().Be(1); savedJob.SubmittedBy.Should().Be("test user"); savedJob.Status.Should().Be(JobStatusType.Ready); savedJob.NotifyEmail.Should().Be("*****@*****.**"); savedJob.CrossLoadingStatus.Should().Be(null); }