MVFC.Pack.Testing
4.0.0
dotnet add package MVFC.Pack.Testing --version 4.0.0
NuGet\Install-Package MVFC.Pack.Testing -Version 4.0.0
<PackageReference Include="MVFC.Pack.Testing" Version="4.0.0" />
<PackageVersion Include="MVFC.Pack.Testing" Version="4.0.0" />
<PackageReference Include="MVFC.Pack.Testing" />
paket add MVFC.Pack.Testing --version 4.0.0
#r "nuget: MVFC.Pack.Testing, 4.0.0"
#:package MVFC.Pack.Testing@4.0.0
#addin nuget:?package=MVFC.Pack.Testing&version=4.0.0
#tool nuget:?package=MVFC.Pack.Testing&version=4.0.0
MVFC.Pack.Testing
Metapackage for unit and integration testing — xUnit v3, NSubstitute, Bogus, AutoBogus, FluentAssertions and Testcontainers, all pinned and ready.
Motivation
Writing tests from the first commit requires the same ecosystem every time: a test framework, a mocking library, a fake-data generator, an assertion library with readable failure messages, and a way to spin up real infrastructure (databases, brokers) without managing Docker Compose files manually.
MVFC.Pack.Testing ships all of them, pinned to compatible versions, so your test project is productive from the moment the package is installed.
Installation
dotnet add package MVFC.Pack.Testing
Quick Start
// 1. Unit test with NSubstitute + FluentAssertions
public class OrderServiceTests
{
private readonly IOrderRepository _repo = Substitute.For<IOrderRepository>();
private readonly OrderService _sut;
public OrderServiceTests() => _sut = new OrderService(_repo);
[Fact]
public async Task CreateOrder_ShouldReturnId()
{
_repo.SaveAsync(Arg.Any<Order>()).Returns(Guid.NewGuid());
var result = await _sut.CreateAsync(new CreateOrderRequest("Keyboard", 1));
result.Should().NotBeEmpty();
await _repo.Received(1).SaveAsync(Arg.Any<Order>());
}
}
// 2. Fake data with Bogus
var faker = new Faker<Order>()
.RuleFor(o => o.Id, f => f.Random.Guid())
.RuleFor(o => o.Product, f => f.Commerce.ProductName())
.RuleFor(o => o.Total, f => f.Finance.Amount());
var orders = faker.Generate(10);
// 3. AutoBogus — generate fully populated objects automatically
var order = AutoFaker.Generate<Order>();
// 4. Integration test with Testcontainers — real MongoDB, no mocks
public class OrderRepositoryTests : IAsyncLifetime
{
private readonly MongoDbContainer _mongo = new MongoDbBuilder().Build();
public Task InitializeAsync() => _mongo.StartAsync();
public Task DisposeAsync() => _mongo.DisposeAsync().AsTask();
[Fact]
public async Task Insert_ShouldPersistOrder()
{
var repo = new OrderRepository(_mongo.GetConnectionString());
var order = AutoFaker.Generate<Order>();
await repo.InsertAsync(order);
var found = await repo.GetByIdAsync(order.Id);
found.Should().NotBeNull();
found!.Id.Should().Be(order.Id);
}
}
Included Packages
| Package | Version |
|---|---|
| xunit.v3 | 3.2.2 |
| xunit.v3.extensibility.core | 3.2.2 |
| xunit.runner.visualstudio | 3.1.5 |
| Microsoft.NET.Test.Sdk | 18.0.1 |
| FluentAssertions | 7.0.0 |
| NSubstitute | 5.3.0 |
| Microsoft.AspNetCore.Mvc.Testing | 10.0.3 |
| Bogus | 35.6.5 |
| AutoBogus | 2.13.1 |
| Testcontainers | 4.10.0 |
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AutoBogus (>= 2.13.1)
- Bogus (>= 35.6.5)
- FluentAssertions (= 7.0.0)
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.5)
- Microsoft.NET.Test.Sdk (>= 18.4.0)
- NSubstitute (>= 5.3.0)
- Testcontainers (>= 4.10.0)
- xunit.runner.visualstudio (>= 3.1.5)
- xunit.v3 (>= 3.2.2)
- xunit.v3.extensibility.core (>= 3.2.2)
-
net9.0
- AutoBogus (>= 2.13.1)
- Bogus (>= 35.6.5)
- FluentAssertions (= 7.0.0)
- Microsoft.AspNetCore.Mvc.Testing (>= 9.0.2)
- Microsoft.NET.Test.Sdk (>= 17.13.0)
- NSubstitute (>= 5.3.0)
- Testcontainers (>= 4.10.0)
- xunit.runner.visualstudio (>= 3.1.5)
- xunit.v3 (>= 3.2.2)
- xunit.v3.extensibility.core (>= 3.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.