问题描述
这是我的测试类的设置:
[CollectionDefinition("MyCollection")]
public class MyDefinition : ICollectionFixture<DBName> { }
[Collection("MyCollection")]
public class MyTestBase
{
protected readonly ITestOutputHelper testOutputHelper;
protected DBName db;
public MyTestBase(ITestOutputHelper testOutputHelper,DBName db)
{
this.testOutputHelper = testOutputHelper;
this.db = db;
}
}
[Collection("MyCollection")]
public class MyTests : MyTestBase
{
public MyTests (ITestOutputHelper testOutputHelper,DBName db) : base(testOutputHelper,db)
{
testOutputHelper.WriteLine(db);
}
[Fact]
public void testA() { //Asserts }
[Fact]
public void testB() { //Asserts }
}
当我运行MyTests时,一个测试没有错误运行,但是另一个生成异常:
System.AggregateException : One or more errors occurred. (Cannot find table 0.) (The following constructor parameters did not have matching fixture data: DBName db)
---- System.IndexOutOfRangeException : Cannot find table 0.
---- The following constructor parameters did not have matching fixture data: DBName db
此设置的缺陷是什么,为什么会产生错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)