Permalink
Browse files

If `IStartingMessage` couldn't be queued, do not try to queue `IFinis…

…hedMessage`. (#1759)
  • Loading branch information...
josetr authored and bradwilson committed Jul 12, 2018
1 parent fe67898 commit 1c0989a0b56669b9e52867da749cc2fc8be002e7
@@ -34,16 +34,18 @@ public static class ReflectionAbstractionExtensions
if (!messageBus.QueueMessage(new TestClassConstructionStarting(test)))
cancellationTokenSource.Cancel();
try
{
if (!cancellationTokenSource.IsCancellationRequested)
timer.Aggregate(() => testClass = Activator.CreateInstance(testClassType, constructorArguments));
}
finally
else
{
if (!messageBus.QueueMessage(new TestClassConstructionFinished(test)))
cancellationTokenSource.Cancel();
try
{
if (!cancellationTokenSource.IsCancellationRequested)
timer.Aggregate(() => testClass = Activator.CreateInstance(testClassType, constructorArguments));
}
finally
{
if (!messageBus.QueueMessage(new TestClassConstructionFinished(test)))
cancellationTokenSource.Cancel();
}
}
return testClass;
@@ -70,15 +72,17 @@ public static class ReflectionAbstractionExtensions
if (!messageBus.QueueMessage(new TestClassDisposeStarting(test)))
cancellationTokenSource.Cancel();
try
{
timer.Aggregate(disposable.Dispose);
}
finally
else
{
if (!messageBus.QueueMessage(new TestClassDisposeFinished(test)))
cancellationTokenSource.Cancel();
try
{
timer.Aggregate(disposable.Dispose);
}
finally
{
if (!messageBus.QueueMessage(new TestClassDisposeFinished(test)))
cancellationTokenSource.Cancel();
}
}
}
@@ -42,10 +42,10 @@ protected override Task<RunSummary> RunTestAsync()
if (!MessageBus.QueueMessage(testFailed))
CancellationTokenSource.Cancel();
}
if (!MessageBus.QueueMessage(new TestFinished(test, 0, null)))
CancellationTokenSource.Cancel();
if (!MessageBus.QueueMessage(new TestFinished(test, 0, null)))
CancellationTokenSource.Cancel();
}
return Task.FromResult(summary);
}
@@ -176,10 +176,10 @@ public async Task<RunSummary> RunAsync()
if (Aggregator.HasExceptions)
if (!MessageBus.QueueMessage(new TestCleanupFailure(Test, Aggregator.ToException())))
CancellationTokenSource.Cancel();
}
if (!MessageBus.QueueMessage(new TestFinished(Test, runSummary.Time, output)))
CancellationTokenSource.Cancel();
if (!MessageBus.QueueMessage(new TestFinished(Test, runSummary.Time, output)))
CancellationTokenSource.Cancel();
}
return runSummary;
}

0 comments on commit 1c0989a

Please sign in to comment.