Tests that read like the sentence you had in mind.
Documentation · Sponsor
Mock the file system and the clock, fake any dependency without reflection, and get failure messages that explain themselves. Three libraries, each useful on its own, better together.
|
“It reads files, checks the date or rolls a dice.” Mock the unmockable. Inject |
“When it fails, I can't tell why.” Readable, AOT-ready assertions. Every expectation is awaited, for values, tasks, streams and exceptions alike. |
“It needs a collaborator I don't want in the test.” AOT-ready mocking for .NET. Source-generated mocks, set up with regular method calls. No reflection, no proxies. |
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
}| Package | Verifies |
|---|---|
| aweXpect.Json | JSON by its structure, ignoring whitespace and property order |
| aweXpect.Logging | what your code logged with Microsoft.Extensions.Logging |
| aweXpect.Mockolate | the interactions with a Mockolate mock |
| aweXpect.Reflection | architecture and naming conventions |
| aweXpect.Snapshots | large or generated output and the public API of an assembly |
| aweXpect.Testably | the state of a MockFileSystem and MockTimeSystem |
| aweXpect.Web | HTTP requests and responses |
| aweXpect.Xml | XML by its content, ignoring attribute order and whitespace |
Use aweXpect.Chronology to write 5.Seconds() or 24.December(2024) instead of TimeSpan.FromSeconds(5) or new DateTime(2024, 12, 24). It works on its own, also without aweXpect.
Free and open source under the MIT license.