Dispose Context after each Scenario if Context implements IDisposable
See original GitHub issueDescription
As far as I can tell and see in debugging, context objects are never disposed.
I believe it is possible to manually do this in xUnit2 by not using the automatic .WithContext<T>()
method, but providing an instance and later disposing of it, but that isn’t as nice and leaves room for errors.
My scenarios use a local server for testing API round trips. The server is started and destroyed on each call to clean the slate as it were.
Progress
- Implement scenario context disposing,
- Implement step context disposing,
- Implement context disposal exception propagation,
- Ensured backward-compatibility,
- Ensured good debugging experience
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
dbcontext - Entity Framework and calling context.dispose()
As some people commented, an exception to this rule is when a context is part of a component that implements IDisposable itself and...
Read more >Do I always have to call Dispose() on my DbContext objects ...
Even though it does implement IDisposable, it only implements it so you can call Dispose as a safeguard in some special cases. By...
Read more >Dispose Pattern - Framework Design Guidelines
IDisposable interface and declaring the Dispose(bool) method that implements all resource cleanup logic to be shared between the Dispose method ...
Read more >Is it OK to create an Entity Framework DataContext object ...
Although the DbContext implements IDisposable , you shouldn't manually dispose it, nor should you wrap it in a using statement.
Read more >IDisposable Interface (System)
The following example demonstrates how to create a resource class that implements the IDisposable interface. #using <System.dll> #using <System.Windows.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will do, thanks for the quick turn around, nobody but us is geeking out on NYE haha
I’ll be upgrading! Great quality of life upgrade thanks!