-
|
I have a situation where I have data from an IAsyncInitializer data source. I want to use that data as input for tests. For instance public sealed class ContainerBasedTests
{
//Docker container
[ClassDataSource<Container>(Shared = SharedType.PerClass)]
public required Container Container { get; init; }
//Enumerable from container
public IEnumerable<Func<IMyService>> Executions
=> Container.TestExecutions().Select(e => new Func<IMyService>(() => e));
//Inits many containers because each value from Executions inits a new container. Might be bug?
[Test]
[InstanceMethodDataSource("Executions")]
public async Task TestElementFromContainer(IMyService service, CancellationToken token)
{
var entity = await service.ExecuteAsync();
await Assert.That(entity).IsNotNull();
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
thomhurst
Dec 6, 2025
Replies: 1 comment 1 reply
-
|
I think I'd need to expose a new interface like |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@TheRumle Try v1.5.0 and use IAsyncDiscoveryInitializer