C# 为什么xUnit测试抛出AggregateException?
这是我的测试类的设置:C# 为什么xUnit测试抛出AggregateException?,c#,xunit,xunit.net,C#,Xunit,Xunit.net,这是我的测试类的设置: [CollectionDefinition("MyCollection")] public class MyDefinition : ICollectionFixture<DBName> { } [Collection("MyCollection")] public class MyTestBase { protected readonly ITestOutputHelper testOutputHelper;
[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 }
}
此设置中的缺陷是什么,为什么会产生错误。请共享一个。是的,我很困惑,因为夹具适用于一个测试,但不适用于另一个测试。您确定
索引自动失效异常
不是来自您的夹具吗?它试图告诉你这两个问题?还有:什么是optDB
/OptimaDB
?代码中没有显示这些内容,它只是打印db名称,以确保整个类集合的db名称相同。将其重命名为db。。。
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