简体   繁体   English

单元测试 - XUnit - IAssemblyFixture - 以下构造函数参数没有匹配的夹具数据

[英]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.

相关问题 单元测试xunit以下构造函数参数没有匹配的夹具数据 - Unit Testing xunit The following constructor parameters did not have matching fixture data 具有依赖注入构造函数参数的 XUnit 没有匹配的夹具数据 - XUnit with Dependency Injection constructor parameters did not have matching fixture data PlatformNotSupportedException:以下构造函数参数没有匹配的fixture数据 - PlatformNotSupportedException: The following constructor parameters did not have matching fixture data 以下构造函数参数没有匹配的夹具数据 - The following constructor parameters did not have matching fixture data 在哪里创建 HostBuilder 并避免“以下构造函数参数没有匹配的夹具数据” - Where to create HostBuilder and avoid 'The following constructor parameters did not have matching fixture data' 收到错误以下构造函数参数没有匹配的夹具数据:PostgreSqlResource 资源 - getting an error The following constructor parameters did not have matching fixture data: PostgreSqlResource resource 使用 XUNIT 进行 ServiceBusTrigger 单元测试 - ServiceBusTrigger Unit testing with XUNIT 单元测试中的依赖注入,xUnit - Dependency injection in unit testing, xUnit 使用 XUnit 和 Moq 对 DynamoDB 进行单元测试 - Unit testing DynamoDB with XUnit and Moq 使用 Moq 和 xUnit 对服务进行单元测试 - Unit Testing a Service with Moq & xUnit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM