[英]Unit Testing - XUnit - IAssemblyFixture -The following constructor parameters did not have matching fixture data
Right now, i would like to share the context entire assembly.现在,我想分享整个程序集的上下文。 To sort out this use-cases, i have started using IAssemblyFixture: this is how my code looks为了整理这些用例,我开始使用 IAssemblyFixture:这就是我的代码的样子
-- Context
public class AssemblyLevelRepoFixture
{
}
public class TestBaseAssemblyFixture : Xunit.Extensions.AssemblyFixture.IAssemblyFixture<AssemblyLevelRepoFixture>
{
private readonly ITestOutputHelper testOutputHelper;
private readonly AssemblyLevelRepoFixture fixture;
}
public class SampleTest : TestBaseAssemblyFixture
{
public SampleTest(ITestOutputHelper testOutputHelper, AssemblyLevelRepoFixture fixture) : base (testOutputHelper, fixture)
{
// hellow how are you;
}
public void FirstTest()
{
Assert.True(true);
}
}
-- I am facing issue: The following constructor parameters did not have matching fixture data: AssemblyLevelRepoFixture fixture -- 我面临问题:以下构造函数参数没有匹配的夹具数据:AssemblyLevelRepoFixture 夹具
You need to add this attribute:您需要添加此属性:
using Xunit;
using Xunit.Extensions.AssemblyFixture;
[assembly: TestFramework(AssemblyFixtureFramework.TypeName, AssemblyFixtureFramework.AssemblyName)]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.