Пример #1
0
        public async Task ClaimJobsToRunAsyncByMaxNumTest()
        {
            var job = new Job
            {
                AppID     = AppID,
                Created   = DateTime.Now,
                Status    = null,
                ProcessID = null
            };

            job = jobDAL.SetJob(job);
            Assert.True(!string.IsNullOrWhiteSpace(job.JobID));

            var jobs = await jobDAL.ClaimJobsToRunAsync(processID, 10);

            jobDAL.Delete(new List <string> {
                job.JobID
            });

            var jobIDs = jobs.Select(j => j.JobID).ToList();

            Assert.True(jobIDs.Contains(job.JobID));
        }
Пример #2
0
        public void DeleteOldJobs_NotStarted()
        {
            var job = new Job
            {
                AppID   = AppID,
                Created = DateTime.Now.AddHours(-48)
            };

            job = jobDAL.SetJob(job);

            var count = jobDAL.Delete(24, new List <JobStatus?> {
                null
            });
            var outJob = jobDAL.GetJob(job.JobID);

            Assert.True(count > 0);
            Assert.Null(outJob);
        }