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

Add possibility to use async/await in the tests #255

Open
DmitryBogatko opened this issue Jul 18, 2024 · 0 comments
Open

Add possibility to use async/await in the tests #255

DmitryBogatko opened this issue Jul 18, 2024 · 0 comments
Assignees

Comments

@DmitryBogatko
Copy link
Contributor

At the moment AquaityService uses ThreadLocal to keep AppContainer and ServiceProviderContainer instances.
But it brings problems if you want to make your tests to be used in async context.
To solve this we must use AsyncLocal instead
https://learn.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?view=net-8.0&redirectedfrom=MSDN

private static readonly ThreadLocal<TApplication> AppContainer = new ThreadLocal<TApplication>();
private static readonly ThreadLocal<IServiceProvider> ServiceProviderContainer = new ThreadLocal<IServiceProvider>();
@DmitryBogatko DmitryBogatko self-assigned this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant