Example #1
0
        public void AddCancelTest()
        {
            var job = ActiveJob();

            job.Plan.GetCurrentTask().State = ExecutionState.Canceled;
            JobRepository.Add(job);
            Assert.That(JobRepository.WaitingJobs(), Is.Empty);
            Assert.That(JobRepository.DoneJobs(), Is.Empty);
            Assert.That(JobRepository.ActiveJobs(), Is.Empty);
            Assert.That(JobRepository.CanceledJobs().Count(), Is.EqualTo(1));
        }
        public DashboardInfo GetDashboardInfo(DateTime?recentlyFilter = null)
        {
            if (!recentlyFilter.HasValue)
            {
                recentlyFilter = _timeProvider.GetUtcNow().AddHours(-1);
            }
            var res = new DashboardInfo
            {
                WaitingJobs          = _jobRepository.WaitingJobs().Select(Mapper.Map <DashboardJob>),
                ActiveJobs           = _jobRepository.ActiveJobs().Select(Mapper.Map <DashboardJob>),
                RecentlyDoneJobs     = _jobRepository.DoneJobs(recentlyFilter).Select(Mapper.Map <DashboardJob>),
                RecentlyFailedJobs   = _jobRepository.FailedJobs(recentlyFilter).Select(Mapper.Map <DashboardJob>),
                RecentlyCanceledJobs = _jobRepository.CanceledJobs(recentlyFilter).Select(Mapper.Map <DashboardJob>),
                Plugins = _plugins.Select(Mapper.Map <DashbaordPlugin>)
            };

            return(res);
        }