static async Task ExecuteWhens(ComponentRunner component, CancellationTokenSource cts) { var token = cts.Token; try { await component.ComponentsStarted(token).ConfigureAwait(false); } catch (Exception ex) when(!ex.IsCausedBy(token)) { cts.Cancel(); TestContext.WriteLine($"Whens for endpoint {component.Name} failed to execute."); throw; } }
static async Task StartEndpoint(ComponentRunner component, CancellationTokenSource cts) { var token = cts.Token; try { await component.Start(token).ConfigureAwait(false); } catch (Exception) { cts.Cancel(); TestContext.WriteLine($"Endpoint {component.Name} failed to start."); throw; } }