-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NUnit1032 on MsSqlContainer.DisposeAsync()
#781
Comments
(Hmm, I realize that making the I saw an exception message about |
I thought the rule recognized public Task OneTimeTearDown() {
await _msSqlContainer.DisposeAsync();
} |
I should have read your second email before responding. |
Yeah, but no worries. 👍 If we really wanted to make it perfect, I guess we could make the rule (or another rule...) warn about |
That is more generic than NUnit and hold for all Async inside non-Async method. The Microsoft.VisualStudio.Threading.Analyzers does raise a warning for this: |
Hi,
With the following test class:
...I get a warning/error saying
17>SomeControllerTests.cs(84,28): Error NUnit1032 : The field _msSqlContainer should be Disposed in a method annotated with [OneTimeTearDownAttribute] (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit1032.md)
I realize why this happens; the
MsSqlContainer
(from https://dotnet.testcontainers.org/modules/mssql/) doesn't implement theIDisposable
interface but onlyIAsyncDisposable
, which is why we have to do it this way in theOneTimeTearDown
method.Should we consider this a shortcoming/deficiency in NUnit(.Analyzers) or should this be reported upstream to TestContainers.NET, WDYT? 🤔
The text was updated successfully, but these errors were encountered: