UPDATE: AutoFixture team released a fix for this in version 3.51.
Simply extend the AutoDataAttribute
doing so:
public class AutoDataFixedNameAttribute : AutoDataAttribute
{
public AutoDataFixedNameAttribute()
{
this.TestMethodBuilder = new FixedNameTestMethodBuilder();
}
}
Then use this new attribute instead of the built-in AutoData
in your NUnit tests.
Starting from v4, this behavior is the default one.
Previous post
I'm trying to use AutoFixture with NUnit and Moq, using the following AutoMoqDataAttribute :
public class AutoMoqDataAttribute : AutoDataAttribute
{
public AutoMoqDataAttribute()
: base(new Fixture().Customize(new AutoMoqCustomization()))
{
}
}
But when I run this test :
[Test, AutoMoqData]
public void Test(Mock<IUser> user)
{
// do stuff with user
}
The test never runs. AutomMoqData is hit correctly, but the code inside the test is never executed and everything ends without any warning with the following message :
Test adapter sent back a result for an unknown test case. Ignoring result for 'Test(Mock<Sandbox.IUser>)'
The test also doesn't appear in the test runner list.
But if I remove the parameter :
[Test, AutoMoqData]
public void Test()
{
// do stuff without user
}
Everything runs fine, but this is less useful without the parameters passed :)
Am I missing something here ?
Here is the list of the Nuget packages versions :
<package id="AutoFixture" version="3.50.2" targetFramework="net452" />
<package id="AutoFixture.AutoMoq" version="3.50.2" targetFramework="net452" />
<package id="AutoFixture.NUnit3" version="3.50.2" targetFramework="net452" />
<package id="Moq" version="4.5.3" targetFramework="net452" />
<package id="NUnit" version="3.7.1" targetFramework="net452" />
EDIT: Following @MarkSeemann's advice, I filed an issue on Github.