public AsyncCommandWithInput(IAsyncCommandWatcher <object> asyncCommandWatcher, Func <TIn, Task> command, INotifyTaskCompletion <object> notifyTaskCompletion, ITaskWrapper taskWrapper) : base(asyncCommandWatcher) { _asyncCommandWatcher = asyncCommandWatcher; _command = command; _notifyTaskCompletion = notifyTaskCompletion; _taskWrapper = taskWrapper; }
public void Setup() { _notifyTaskCompletion = A.Fake <INotifyTaskCompletion <object> >(); _taskWrapper = A.Fake <ITaskWrapper>(); _asyncCommandWatcher = A.Fake <IAsyncCommandWatcher <object> >(); _command = async(intIn) => { }; _wrappedCommand = async() => null; _asyncCommandWithInput = new AsyncCommandWithInput <int>(_asyncCommandWatcher, _command, _notifyTaskCompletion, _taskWrapper); }
private void RunTask(Operation operation) { if (currentTask != null) { logger.LogDebug("Dispose running task"); currentTask.Dispose(); currentTask = null; } if (taskFactories.TryGetValue(operation, out ITaskFactory factory)) { currentTask = factory.Create(); currentTask.Start(); } else { logger.LogWarning("Missing task for operation {0}", operation); } }
public AsyncCommandFactory(INotifyTaskCompletionFactory notifyTaskCompletionFactory, IAsyncCommandWatcherFactory asyncCommandWatcherFactory, ITaskWrapper taskWrapper) { _notifyTaskCompletionFactory = notifyTaskCompletionFactory; _asyncCommandWatcherFactory = asyncCommandWatcherFactory; _taskWrapper = taskWrapper; }