One test, three libraries
A service that exports a report to disk and notifies the team. No temp folder, no hand-written fake, no guessing what failed.
[Test]public async Task Export_WritesReportAndNotifiesTeam(){ MockFileSystem fileSystem = new();← Testably.Abstractions INotifier notifier = INotifier.CreateMock();← Mockolate ReportService sut = new(fileSystem, notifier); await sut.ExportAsync("Q3"); await That(fileSystem).HasFile("reports/Q3.json");← aweXpect.Testably await That(notifier.Mock.Verify.Send("Report Q3 exported")).Once();← aweXpect.Mockolate}MockFileSystem behaves like the real one on Windows, Linux and macOS, all in memory.
CreateMock() is source-generated: a typo in a setup is a compile error.
HasFile(…) reads as a sentence and names the missing path when it fails.
What makes your code hard to test?
Each library removes a different reason to skip a test. Start with the one that matches yours.
Inject IFileSystem, ITimeSystem and IRandomSystem. Swap in in-memory mocks for tests.
MockTimeSystem time = new();
time.TimeProvider.AdvanceBy(
TimeSpan.FromDays(60));v8.0.0 · Windows, Linux, macOSGet started with Abstractions →“When it fails, I can't tell why.”Every expectation is awaited, for values, tasks, streams and exceptions alike.
await That(message)
.IsEqualTo("It's a compliment");
// but it was "It's a complement"v4.0.0 · TUnit, xUnit, NUnit, MSTestGet started with aweXpect →“It needs a collaborator I don't want in the test.”Source-generated mocks, set up with regular method calls. No reflection, no proxies.
dispenser.Mock.Setup
.Dispense("Dark", It.IsAny<int>())
.Returns(true);v3.6.0 · netstandard2.0 to .NET 11Get started with Mockolate →aweXpect extensions
Compare JSON by its structure instead of its formatting, and check single properties of JsonElement and JsonNode.
await That(json).IsEqualTo(expected).AsJson();
await That(json).IsValidJsonMatching(new { title = "Let It Be" });Read the aweXpect.Json docs →Testably and Mockolate bridge the family: assertions on a MockFileSystem and on Mockolate interactions.
Writing durations? aweXpect.Chronology turns 5.Seconds() and 24.December(2024) into TimeSpan and DateTime values, no aweXpect needed.