tomaszeman / Xunit.Extensions.Ordering

Xunit extension with full support for ordered testing at collection, class and test case levels. Full-featured AssemblyFixture implementation.
Apache License 2.0
53 stars 9 forks source link

IAssemblyFixture fails #3

Closed johnknoop closed 5 years ago

johnknoop commented 5 years ago

This is my test class:

public class MyTestClass : IAssemblyFixture<MyFixture>
{
    private readonly MyFixture _fixture;

    public MyTest(MyFixture fixture)
    {
        _fixture = fixture;
    }

    [Fact]
    public async Task MyTest()
    {
        // test code omitted
    }
}

When I run the test, it fails with this exception:

The following constructor parameters did not have matching fixture data: MyFixture fixture Exception doesn't have a stacktrace

The MyFixture class implements IDisposable.

If I replace IAssemblyFIxture with IClassFixture, everything works.

tomaszeman commented 5 years ago

Pls register TestFramework replacement. Sorry if it isn't clear from docs.

[assembly: TestFramework("Xunit.Extensions.Ordering.TestFramework", "Xunit.Extensions.Ordering")]

johnknoop commented 5 years ago

I understand. Where is the best way to put that in a .Net Core project? (they don't have an AssemblyInfo file by default)

tomaszeman commented 5 years ago

It's up to you. I use AssemblyInfo.cs file.

johnknoop commented 5 years ago

This seemed to do the trick. Thanks!