Installation

Install AutoFixture 5.0.0-rc.1 from NuGet for .NET 8 and later test projects.

Add AutoFixture to your test project from NuGet. Pin the version so everyone on the team uses the same release.

Prerequisites

  • .NET 8 SDK or later
  • An existing test project (xUnit.net 3, NUnit 4, or plain test class library)

Install AutoFixture

Add the core package to your test project:

<PackageReference Include="AutoFixture" Version="5.0.0-rc.1" />

Or with the .NET CLI:

dotnet add package AutoFixture --version 5.0.0-rc.1

Verify installation

After restore, confirm you can create a fixture and generate a value:

var fixture = new Fixture();
var value = fixture.Create<int>();
Assert.NotEqual(default, value);

If this passes, AutoFixture is ready to use in your tests.

Optional packages

PackageWhen you need it
AutoFixture.Xunit3xUnit.net 3 test projects
AutoFixture.NUnit4NUnit 4 test projects
AutoFixture.AutoMoqMoq mocks
AutoFixture.AutoNSubstituteNSubstitute substitutes
AutoFixture.AutoFakeItEasyFakeItEasy fakes
AutoFixture.SeedExtensionsSeeded Create / CreateMany / Freeze overloads
AutoFixture.IdiomsGuard-clause and idiom assertions

See the integrations overview and full package list.

Next steps