Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create and initialize the TestStore inside InitializeAsync
Before this commit, it was impossible to create a concrete implementation of SharedStoreFixtureBase that requires a `TestStoreFactory` which is initialized asynchronously (the purpose of `IAsyncLifetime`). After this commit, it becomes possible because the `TestStoreFactory` and the `StoreName` properties are not accessed in the constructor anymore: ```csharp public class MySharedStoreFixture<TContext> : SharedStoreFixtureBase<TContext> where TContext : DbContext { private string? _storeName; private ITestStoreFactory? _testStoreFactory; protected override string StoreName => _storeName ?? throw new InvalidOperationException($"The {nameof(StoreName)} property is only available after {nameof(InitializeAsync)} has executed."); protected override ITestStoreFactory TestStoreFactory => _testStoreFactory ?? throw new InvalidOperationException($"The {nameof(TestStoreFactory)} property is only available after {nameof(InitializeAsync)} has executed."); public override async Task InitializeAsync() { var someInfo = await GetSomeInfoAsync(); _storeName = someInfo.Name; _testStoreFactory = new MyTestStoreFactory(someInfo); await base.InitializeAsync(); } } ```
- Loading branch information