Autofixture autodetect error: no arguments found

I am trying to use the AutoData function in AutoFixture for my NUnit tests like this:

[Test]
[AutoData]
public void PharmaciesAndDelegatesShouldBeLinkedEachOther(string s) {
    ...
}

      

However, when I run the test, I get the following error. Everything else in the test works correctly until I pass this parameter:

Result message: No arguments were provided.

What am I doing wrong?

+3


source to share


2 answers


Oddly enough, the NUnitTestAdapter package is incompatible with the Autofixture AutoData attribute ... I installed TestDriven.Net and ran tests with it and AutoData works fine without any problem loading parameters into the method.



Thanks for all your answers!

+2


source


Make sure the testing project has the latest version of the NUnit package (2.6.3) NuGet installed. If you are using your own NUnit runner (console or GUI) make sure you are using the latest version (2.6.3)

Then, if you have the AutoFixture.Nunit2 package installed in your test project and you are using the latest NUnit 2.6.3 and Resharper at least 8.1, you need to manually add the redirect binding to the app.config file of your test project (as stated in the file readme.txt, which was opened after installing the AutoFixture.Nunit2 package):

<dependentAssembly>
    <assemblyIdentity name="nunit.core.interfaces" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
</dependentAssembly>

      

If you don't have an app.config file in your test project, add it and paste the following content:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
          <assemblyIdentity name="nunit.core.interfaces" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
      </dependentAssembly> 
    </assemblyBinding>
  </runtime>
</configuration>

      

Aferward, check if you have added the following class to your test project (Should be added when installing the AutoFixture.Nunit2 package in the LocalAddin.cs file)

using NUnit.Core.Extensibility;

namespace Test.Project
{
    [NUnitAddin]
    public class LocalAddin : Ploeh.AutoFixture.NUnit2.Addins.Addin
    {   
    }
}

      

It's all. I am using VS2013, NUnit 2.6.3, AutoFixture.Nunit2 3.21.1, Resharper is testing runner and native NUnit runners (console and GUI) and it works great.

+8


source







All Articles