Skip to content

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

@DmitryBogatko

Description

@DmitryBogatko

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>();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions