Test classes cannot be nested within a generic class
Test classes cannot be nested within a generic class.
Generic types must be instantiated with types provided, which xUnit.net cannot provide. Test classes embedded within generic types, therefore, cannot be instantiated or executed.
To fix a violation of this rule, move the test class outside the scope of the generic type.
using Xunit;
public class GenericClass<T>
{
public class TestClass
{
[Fact]
public void TestMethod() { }
}
}
using Xunit;
public class GenericClass<T>
{
}
public class TestClass
{
[Fact]
public void TestMethod() { }
}