site/xunit.analyzers/rules/xUnit9000.md
A violation of this rule occurs when a type needs to have a non-obsolete, non-static public constructor that matches a specific pattern, but none of the available constructors meet the requirements.
The code generator needs to call the constructor with a specific set of arguments (or an empty argument list), but there is no constructor that meets the requirement.
To fix a violation of this rule, create a constructor that meets the requirements.
using Xunit;
[assembly: AssemblyFixture(typeof(MyAssemblyFixture))]
public class MyAssemblyFixture
{
public MyAssemblyFixture(int x)
{ /*...*/ }
}
error xUnit9000: Type 'MyAssemblyFixture' must have a non-obsolete public constructor: public MyAssemblyFixture()
[assembly: TestFramework(typeof(MyTestFramework))]
public class MyTestFramework : ITestFramework
{
public MyTestFramework(int x)
{ /*...*/ }
// ...implementation of ITestFramework...
}
error xUnit9000: Type 'MyTestFramework' must have a non-obsolete public constructor: public MyTestFramework(string? configFileName)
using Xunit;
[assembly: AssemblyFixture(typeof(MyAssemblyFixture))]
public class MyAssemblyFixture
{
public MyAssemblyFixture()
{ /*...*/ }
}
[assembly: TestFramework(typeof(MyTestFramework))]
public class MyTestFramework : ITestFramework
{
public MyTestFramework(string? configFileName)
{ /*...*/ }
// ...implementation of ITestFramework...
}