Until the (imminent) release of AutoFixture 4, there is currently no support for AutoFixture within .NET Core.
AutoFixture 4 is now available on the official NuGet feed, however the rest of this article is useful if you ever need to use a package on a different feed.
However, we can solve the issue in the short term by using a vNext feed of AutoFixture hosted on MyGet.
You can create a
nuget.config file as a sibling to your Visual Studio Solution (
.sln) file with the AutoFixture MyGet package feed configured:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" /> <add key="AspNetCoreTools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" /> <add key="NuGet" value="https://api.nuget.org/v3/index.json" /> <add key="AutoFixture MyGet" value="https://www.myget.org/F/autofixture/api/v3/index.json" /> </packageSources> </configuration>
With the AutoFixture feed configured, you can create an xUnit.net Test Project (.NET Core) within Visual Studio 2017.
Install the following packages from the AutoFixture MyGet feed:
Ensure to include pre-release versions to view these packages
Install the following from the standard NuGet feed:
Moq(this ensures you're using a later version of
Moqthan that included with
Then an appropriate assertion package, depending on your preference, e.g:
This should give you everything you need to start testing.