Exemplo n.º 1
0
        public void CountRunningJobsTest()
        {
            var job1 = new Job
            {
                AppID     = AppID,
                Created   = DateTime.Now,
                Status    = null,
                ProcessID = processID
            };

            job1 = jobDAL.SetJob(job1);
            Assert.True(!string.IsNullOrWhiteSpace(job1.JobID));
            jobDAL.SetToRunning(processID, job1.JobID);

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

            job2 = jobDAL.SetJob(job2);
            Assert.True(!string.IsNullOrWhiteSpace(job2.JobID));
            jobDAL.SetToRunning(processID, job2.JobID);

            var count = jobDAL.CountRunningJobs(processID);

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

            Assert.True(count >= 2);
        }