Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Fix tests to use Assert.Throw instead of Assert.ThrowsAsync when relevant - #30145

Merged
stephentoub merged 4 commits into
dotnet:masterfrom
stephentoub:fixtasktests
Jun 5, 2018
Merged

stephentoub merged 4 commits into
dotnet:masterfrom
stephentoub:fixtasktests

Conversation

@stephentoub

Copy link
Copy Markdown
Member

A bunch of asserts in the System.Threading.Tasks tests were nops because they were using Assert.ThrowsAsync and then not awaiting the result. But they actually should never have been ThrowsAsync in the first place, as they were all validating that exceptions propagated out of the delegate synchronously. So, I just changed them all to be Assert.Throws instead of Assert.ThrowsAsync.

I searched the rest of the repo as well and fixed up other such cases, in System.Threading.Tasks.Dataflow.Tests, in System.Data.SqlClient.Tests, and in System.Net.Security.Tests.

Addresses #2775 (comment)
cc: @jnm2, @tarekgh

A bunch of asserts in the System.Threading.Tasks tests were nops because they were using Assert.ThrowsAsync and then not awaiting the result.  But they actually should never have been ThrowsAsync in the first place, as they were all validating that exceptions propagated out of the delegate synchronously.  So, I just changed them all to be Assert.Throws instead of Assert.ThrowsAsync.
@stephentoub

Copy link
Copy Markdown
Member Author

@dotnet-bot test Outerloop Linux x64 Debug Build

@stephentoub
stephentoub merged commit 1c7af95 into dotnet:master Jun 5, 2018
@stephentoub
stephentoub deleted the fixtasktests branch June 5, 2018 17:41
@karelz karelz added this to the 3.0 milestone Jul 8, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Fix tests to use Assert.Throw instead of Assert.ThrowsAsync when relevant

Commit migrated from dotnet/corefx@1c7af95
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants