From 3272c3f0f9d20cd17ee307df6cdcbbc5dd7fab2a Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 19 May 2020 09:16:28 -0700 Subject: [PATCH] Assert a stronger exception condition --- src/EditorFeatures/Test/Utilities/AsyncLazyTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/EditorFeatures/Test/Utilities/AsyncLazyTests.cs b/src/EditorFeatures/Test/Utilities/AsyncLazyTests.cs index c8a6cabf502..c5ec3b3454e 100644 --- a/src/EditorFeatures/Test/Utilities/AsyncLazyTests.cs +++ b/src/EditorFeatures/Test/Utilities/AsyncLazyTests.cs @@ -45,16 +45,13 @@ private static void CancellationDuringInlinedComputationFromGetValueOrGetValueAs includeSynchronousComputation ? synchronousComputation : null, cacheResult: true); - var thrownException = Assert.ThrowsAny(() => + var thrownException = Assert.Throws(() => { // Do a first request. Even though we will get a cancellation during the evaluation, // since we handed a result back, that result must be cached. doGetValue(lazy, requestCancellationTokenSource.Token); }); - // Assert it's either cancellation or aggregate exception - Assert.True(thrownException is OperationCanceledException || ((AggregateException)thrownException).InnerException is OperationCanceledException); - // And a second request. We'll let this one complete normally. var secondRequestResult = doGetValue(lazy, CancellationToken.None); -- GitLab