site/xunit.analyzers/rules/xUnit9003.md
A violation of this rule occurs when a type does not a single public constructor.
When this rule is violated, it's because the source generator either found 0 public constructors, or found more than one, that met the requirements (public, non-static, non-[Obsolete]).
This is most commonly shown for types used as fixtures.
To fix a violation of this rule, ensure there is only a single public, non-static, non-[Obsolete] constructor.
using Xunit;
public class xUnit9003 : IClassFixture<MyFixture>
{
[Fact]
public void TestMethod() { }
}
public class MyFixture
{
public MyFixture() { }
public MyFixture(int _) { }
}
using Xunit;
public class xUnit9003 : IClassFixture<MyFixture>
{
[Fact]
public void TestMethod() { }
}
public class MyFixture
{
public MyFixture(int _) { }
}