示例#1
0
 public void PrintState()
 {
     Console.WriteLine("Worker state: " + worker_state.ToString());
     if (current_task != null)
     {
         Console.WriteLine("Task type: " + current_task.GetTaskType());
         //Console.WriteLine(current_task);
     }
     else
     {
         Console.WriteLine("Task type: No task assigned!");
     }
 }
示例#2
0
文件: WorkerBase.cs 项目: ewin66/Arya
        public static string GetFriendlyWorkerState(WorkerState state)
        {
            switch (state)
            {
            case WorkerState.New:
                return("Queued");

            case WorkerState.Complete:
                return("Completed");

            case WorkerState.Abort:
                return("Aborted");

            case WorkerState.CompletedWithWarning:
                return("Completed with warning(s)");

            case WorkerState.AbortedByUser:
                return("Aborted by user");

            default:
                return(state.ToString());
            }
        }
        private static async Task TestJob(this ICommandAdapter adapter, WorkerState workerState, int workersCount)
        {
            adapter.Execute(new ActionCommand("Trigger"));
            await adapter.Execute(() => adapter.Execute(new ActionCommand(Actions.Refresh), new CheckListViewCommand <Job>(job => job.Workers, workersCount)));

            adapter.Execute(new SelectObjectsCommand <Job>(job => job.Workers, nameof(JobWorker.State), new [] { workerState.ToString() }));

            adapter.Execute(new ActionCommand("Dashboard"));
            await adapter.Execute(() => {
                var webDriver = adapter.Driver();
                webDriver.SwitchTo().Window(webDriver.WindowHandles[1]);
                webDriver.Url.ShouldContain("/hangfire/jobs/details/");
                webDriver.Close();
                webDriver.SwitchTo().Window(webDriver.WindowHandles[0]);
            });

            adapter.Execute(new ProcessRecordCommand <Job, JobWorker>(job => job.Workers, (worker => worker.State, workerState.ToString())));
            adapter.Execute(new CheckDetailViewCommand <JobWorker>((worker => worker.State, workerState.ToString())));
            adapter.Execute(new ActionCommand(Actions.OK));
            adapter.Execute(new NavigateCommand("Default.Order"));
            adapter.Execute(new CheckListViewCommand(nameof(Order), 12));
        }