提交 3272c3f0 编写于 作者: S Sam Harwell

Assert a stronger exception condition

上级 4b550e88
......@@ -45,16 +45,13 @@ private static void CancellationDuringInlinedComputationFromGetValueOrGetValueAs
includeSynchronousComputation ? synchronousComputation : null,
cacheResult: true);
var thrownException = Assert.ThrowsAny<Exception>(() =>
var thrownException = Assert.Throws<OperationCanceledException>(() =>
{
// 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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册