public async Task Run(IReadOnlyList <AssemblyRunInfo> runInfos, string message = null) { using (await executionLock.LockAsync()) { if (message == null) { message = runInfos.Count > 1 || runInfos.FirstOrDefault() ?.TestCases.Count > 1 ? "Run Multiple Tests" : runInfos.FirstOrDefault() ?.TestCases.FirstOrDefault() ?.DisplayName; } if (!await resultChannel.OpenChannel(message)) { return; } try { await RunTests(() => runInfos); } finally { await resultChannel.CloseChannel(); } } }
public static async Task SaveTo(this ICachedResultChannel cachedResultChannel, IResultChannel resultChannel, string message) { if (await resultChannel.OpenChannel(message)) { try { foreach (var testResult in cachedResultChannel.TestResults) { resultChannel.RecordResult(testResult); } } finally { await resultChannel.CloseChannel(); } } }