Can I use AutoData
in .net core 2.2 xunit test projects?
AutoFixture.Xunit
targets .NET Framework 4.5.2 and I can't use it. Maybe there is other NuGet package for .net core?
If you look at the AutoFixture.Xunit package on nuget.org, you may notice the following:
By leveraging the data theory feature of xUnit.net, this extension turns AutoFixture into a declarative framework for writing unit tests. In many ways it becomes a unit testing DSL (Domain Specific Language). For xUnit.net 2, please use the AutoFixture.Xunit2 NuGet Package.
(My emphasis.)
Furthermore, if you expand the Dependencies section, you'll notice that the package's dependency constraints:
AutoFixture (>= 4.6.0)
xunit (>= 1.8.0.1549 && < 2.0.0)
xunit.extensions (>= 1.8.0.1549 && < 2.0.0)
Notice, particularly, that the constraint on xunit is < 2.0.0
. In other words, it only works for xunit 1.8.0.1549 up to 1.9.2 (which I believe is the most recent version less that 2.0).
If you want to use xUnit.net 2.0 or higher, you should, as the documentation states, use the AutoFixture.Xunit2 package. More recent versions also support .NET Core.