Get Started
dotnet add package Xunit.EnumMemberData --version 1.0.2
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
Xunit.EnumMemberData
Xunit.EnumMemberData is a library containing one attribute ([EnumMemberData]) to simplify using enums when writing theories (parameterized unittests) using xunit.
By type of enum
[Theory]
[EnumMemberData(typeof(Gender))]
public void TestWithAllEnumValues_UsingEnumMemberData_ByType(Gender gender)
{
_outputWriter.WriteLine($"Gender: {gender}");
}
By property (or method) with simple return value
[Theory]
[EnumMemberData(nameof(Genders))]
public void TestWithAllEnumValues_UsingEnumMemberData_ByProperty(Gender gender)
{
_outputWriter.WriteLine($"Gender: {gender}");
}
// Normally, xunit uses return values like IEnumerable<object[]>
public static IEnumerable<Gender> Genders
{
get
{
return Enum.GetValues(typeof(Gender)).Cast<Gender>();
}
}
Downloads by Version
Not enough data for chart
Similar & Alternative Packages
Hand-picked matching NuGet libraries based on tags & ecosystem
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.