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
| Package | When you need it |
|---|---|
| AutoFixture.Xunit3 | xUnit.net 3 test projects |
| AutoFixture.NUnit4 | NUnit 4 test projects |
| AutoFixture.AutoMoq | Moq mocks |
| AutoFixture.AutoNSubstitute | NSubstitute substitutes |
| AutoFixture.AutoFakeItEasy | FakeItEasy fakes |
| AutoFixture.SeedExtensions | Seeded Create / CreateMany / Freeze overloads |
| AutoFixture.Idioms | Guard-clause and idiom assertions |
See the integrations overview and full package list.