private async Task <TestResult> StartTest(SequenceDependencyLocator sequenceDependency, UniqueConfiguration item) { RequestConfig requestConfig = item.ToRequestConfig(); await sequenceDependency.ReplaceDependency(requestConfig); await sequenceDependency.ReplaceDependency(item.Validation); await sequenceDependency.Wait(item); var request = Requests.Create(requestConfig); OnTestStart?.Invoke(item.Name); var response = request.Send(); var testResult = new TestResult(item.Name, item.Validation, await response); OnTestFinished?.Invoke(testResult); return(testResult); }
private async Task StartAsync() { var sequenceDependency = new SequenceDependencyLocator(); var tasks = new List <Task>(); foreach (var item in _config.Uniques) { var task = new Task <TestResult>(() => StartTest(sequenceDependency, item).Result); sequenceDependency.Register(item.Name, task); tasks.Add(task); } foreach (var task in tasks) { task.Start(); } await Task.WhenAll(tasks); }