© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3mo ago
TeBeCo

[xUnit v3] How to generating test data dynamically that support IAsyncLifetime

Hello, I'm trying to write an integration test "class" with multiple "test" inside (that be
Theory
Theory
or
Fact
Fact
is fine as long at it work)

What i'm trying to do is something similar to
ClassData
ClassData
where the idea is to have a generator that returns a dynamic
IEnumerable
IEnumerable
of what we could call
CurrentRunData
CurrentRunData
(think like a
record
record
that contains multiple properties)

Except that I want for each
CurrentRunData
CurrentRunData
to be usable is an
IAsyncLifetime.InitializeAsync
IAsyncLifetime.InitializeAsync
(because I need to create some infra such as container or azure specific - no there's no emulator for the part i'm trying to do)
and I also need it to be running the
DisposeAsync
DisposeAsync
for cleaning data

I have a list of "logical fact/test" that I want to run for each of these data emitted and the
InitializeAsync
InitializeAsync
depends on that
CurrentRunData
CurrentRunData
, currently with xUnit the
ClassData
ClassData
and
MemberData
MemberData
are injected at test level, which will not run
InitializeAsync
InitializeAsync
with it

anyone already managed to do that ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Xunit v3 running test cases in parallel
C#CC# / help
4mo ago
Dynamically generating C# classes for deserializing data
C#CC# / help
2y ago
How do you test intrinsics code in xunit?
C#CC# / help
4y ago
✅ Implementing IAsyncLifeTime difference
C#CC# / help
16mo ago