public GateKeeperReadyProcessor(IDataStorage <GateKeeperBot> dataStorage, AsyncTaskExecutor asyncTaskExecutor, IUserChecker userChecker, IMessagesSender messagesSender) { this.dataStorage = dataStorage; this.asyncTaskExecutor = asyncTaskExecutor; this.userChecker = userChecker; this.messagesSender = messagesSender; }
public void Test_01_Init() { var executor = new AsyncTaskExecutor(TaskName, ExecuteAsync); Assert.That(executor.TaskName == TaskName); Assert.That(executor.IsBusy == false); Assert.That(executor.BusyStatus == null); Assert.That(executor.Status == AsyncTaskExecutionStatus.WaitForActivation); }
public async Task Test_02_Execute() { IAsyncTaskExecutor executor = new AsyncTaskExecutor(TaskName, ExecuteAsync); var task = executor.ExecuteTask(null); Assert.That(executor.IsBusy); Assert.That(executor.BusyStatus == TaskName + "..."); await task; Assert.That(executor.IsBusy == false); Assert.That(executor.BusyStatus == null); }
public async Task Test_02_Cancel() { IAsyncTaskExecutor executor = new AsyncTaskExecutor(TaskName, ExecuteTimeConsumingAsync); var task = executor.ExecuteTask(null); Assert.That(executor.IsBusy); Assert.That(executor.BusyStatus == TaskName + "..."); await Task.Delay(10); executor.CancelTask(); await task; Assert.That(executor.IsBusy == false); Assert.That(executor.BusyStatus == null); }
public async Task Test_03_PauseResume() { IAsyncTaskExecutor executor = new AsyncTaskExecutor(TaskName, ExecuteTimeConsumingAsync); var task = executor.ExecuteTask(null); Assert.That(executor.IsBusy); Assert.That(executor.BusyStatus == TaskName + "..."); await Task.Delay(10); executor.PauseTask(); Assert.That(executor.Status == AsyncTaskExecutionStatus.Paused); Assert.That(executor.IsBusy); Assert.That(executor.BusyStatus == TaskName + "..."); executor.ResumeTask(); Assert.That(executor.Status == AsyncTaskExecutionStatus.Resumed); Assert.That(executor.IsBusy); Assert.That(executor.BusyStatus == TaskName + "..."); }
public SearchReadyProcessor(IServiceProvider serviceProvider, IMessagesSender messagesSender, AsyncTaskExecutor asyncTaskExecutor) { this.messagesSender = messagesSender; this.serviceProvider = serviceProvider; this.asyncTaskExecutor = asyncTaskExecutor; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="executor"></param> public AsyncTaskExtension(AsyncTaskExecutor executor = null) { this.executor = executor; }
public AsyncTaskContext() { progress = new ProgressInfo(); taskExecutor = new AsyncTaskExecutor(this); }