public void IndexFor(IlrDesktopTaskKeys ilrDesktopTaskKey, int index) { var taskList = new List <IIlrDesktopTaskDefinition>() { new IlrDesktopTaskDefinition(IlrDesktopTaskKeys.PreExecution), new IlrDesktopTaskDefinition(IlrDesktopTaskKeys.FundingService), new IlrDesktopTaskDefinition(IlrDesktopTaskKeys.MdbCreate), }; NewProvider().IndexFor(ilrDesktopTaskKey, taskList).Should().Be(index); }
public static string GetDisplayText(this IlrDesktopTaskKeys desktopTaskKey) { var type = desktopTaskKey.GetType(); var name = Enum.GetName(type, desktopTaskKey); var displayTextAttribute = type.GetField(name) .GetCustomAttributes(false) .OfType <DisplayTextAttribute>() .First(); return(displayTextAttribute.DisplayText); }
private async Task <IDesktopContext> ExecuteAsyncAction(IlrDesktopTaskKeys ilrDesktopTaskKey, IDesktopContext desktopContext, CancellationToken cancellationToken) { using (var executionLifetimeScope = _lifetimeScope.BeginLifetimeScope(c => { _keyedModules.TryGetValue(ilrDesktopTaskKey, out var module); if (module != null) { c.RegisterModule(module()); } })) { return(await executionLifetimeScope .ResolveKeyed <IDesktopTask>(ilrDesktopTaskKey) .ExecuteAsync(desktopContext, cancellationToken) .ConfigureAwait(false)); } }
public int IndexFor(IlrDesktopTaskKeys ilrDesktopTaskKey, IReadOnlyList <IIlrDesktopTaskDefinition> pipeline) => pipeline.ToList().FindIndex(i => i.Key == ilrDesktopTaskKey);
public async Task <IDesktopContext> ExecuteAsync(IlrDesktopTaskKeys ilrDesktopTaskKey, IDesktopContext desktopContext, CancellationToken cancellationToken) { Task <IDesktopContext> task = ExecuteAsyncAction(ilrDesktopTaskKey, desktopContext, cancellationToken); return(await Task.Run(() => task, cancellationToken).ConfigureAwait(false)); }
public IlrDesktopTaskDefinition(IlrDesktopTaskKeys key, IlrDesktopTaskKeys?failureKey = null, ContextMutatorKeys?failureContextMutatorKey = null) { Key = key; FailureKey = failureKey; FailureContextMutatorKey = failureContextMutatorKey; }
public void DisplayText(IlrDesktopTaskKeys desktopTaskKey, string displayText) { desktopTaskKey.GetDisplayText().Should().Be(displayText); }