Skip to content
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

Support for unit-test isolation with AssemblyLoadContext #3444

Closed
astef opened this issue Dec 15, 2019 · 1 comment
Closed

Support for unit-test isolation with AssemblyLoadContext #3444

astef opened this issue Dec 15, 2019 · 1 comment

Comments

@astef
Copy link

astef commented Dec 15, 2019

Sometimes it is necessary to unit-test the code which relies on a static state or even worse, on the type initializers execution order. Even after fixing this kind of nonsense, the problem doesn't entirely go away, because now you need to test it against different scenarios to avoid false positives.

My solution is intended to solve this problem for .NET Core users, who doesn't have full AppDomain functionality.

It relies on AssemblyLoadContext and IFixtureBuilder extension point to achieve the result. I have basically copy-pasted TestFixtureAttribute code and changed BuildFrom methods to use the type from the newly created AssemblyLoadContext.

This approach have a few limitations:

But in general it works, my tests are no longer sharing static variables!

So I request you to add this killer-feature to the NUnit, to make more users happier.

@rprouse
Copy link
Member

rprouse commented Apr 30, 2021

This issue is marked as an idea/design but hasn't had contributions in years so I am closing. If anyone is interested in working on this idea, post your interest and the team will consider reopening.

@rprouse rprouse closed this as completed Apr 30, 2021
@rprouse rprouse added this to the Closed Without Action milestone Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants