Example #1
0
        public async Task CountRunningJobsAsyncTest()
        {
            var job1 = new Job
            {
                AppID     = AppID,
                Created   = DateTime.Now,
                Status    = null,
                ProcessID = processID
            };

            job1 = await jobDAL.SetJobAsync(job1);

            Assert.True(!string.IsNullOrWhiteSpace(job1.JobID));
            await jobDAL.SetToRunningAsync(processID, job1.JobID);

            var job2 = new Job
            {
                AppID     = AppID,
                Created   = DateTime.Now,
                Status    = null,
                ProcessID = processID
            };

            job2 = await jobDAL.SetJobAsync(job2);

            Assert.True(!string.IsNullOrWhiteSpace(job2.JobID));
            await jobDAL.SetToRunningAsync(processID, job2.JobID);

            var count = await jobDAL.CountRunningJobsAsync(processID);

            //set to stop before delete
            await jobDAL.SetToStoppedAsync(new List <string> {
                job1.JobID, job2.JobID
            });

            await jobDAL.DeleteAsync(new List <string> {
                job1.JobID, job2.JobID
            });

            Assert.True(count >= 2);
        }