简体   繁体   中英

AutoFixture's AutoData attribute with Xunit throws System.InvalidOperationException

I'm using xunit v2.1.0, xunit.extensions v1.8.0.1549, AutoFixture v3.40.0, AutoFixture.Xunit v3.40.0 and I have this simple trivial test that uses AutoData

using Ploeh.AutoFixture.Xunit;
using Xunit;

namespace Tests
{
    public class ToolTests
    {
        [Theory, AutoData]
        public void Test(int foo)
        {
            Assert.NotEqual(0, foo);
        }
     }
}  

And the error that I get in Resharper (v9.2) test runner is

System.InvalidOperationException No data found for Tests.ToolTests.Test Exception doesn't have a stacktrace

I've noticed that xunit.extensions is not the last version (currently v2.0.0), but when I try to update given nuget package I get error:

Unable to resolve dependencies. 'xunit.extensions 2.0.0' is not compatible with 'AutoFixture.Xunit 3.40.0 constraint: xunit.extensions (≥ 1.8.0.1549 && < 2.0.0)'

Any clues why this is happening?

当您使用xUnit 2.0或更高AutoFixture.Xunit时,必须使用AutoFixture.Xunit2包,而不是AutoFixture.Xunit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM