Skip to main content
net10.0net11.0

AwesomeAssertions extensions for Nullean.Snapshots.Http: MatchHttpSnapshot, MatchHttpFileSnapshot and HttpFileTest.

Published
Nov 17, 2026
6d ago
Total Downloads
4.6K
4,608

Install

dotnet add package Nullean.Snapshots.Http.Assertions --version 0.18.0
ProductVersions
.NET
net10.0net11.0

README

Nullean.Snapshots.Http.Assertions

snapshots.

AwesomeAssertions extensions for Nullean.Snapshots.Http: MatchHttpSnapshot for a response, MatchHttpFileSnapshot and HttpFileTest for .http files, compared as trees with secrets redacted.

NuGet

Install

dotnet add package Nullean.Snapshots.Http.Assertions

Quick start

using AwesomeAssertions;
using Nullean.Snapshots;
using Nullean.Snapshots.Http;
using Nullean.Snapshots.TUnit;

public class OrdersApiTests
{
	private static readonly HttpClient Client = new() { BaseAddress = new Uri("http://localhost:5000/") };

	[Test]
	public async Task GetsAnOrder()
	{
		using var response = await Client.GetAsync("/api/orders/3");
		await response.Should().MatchHttpSnapshot();               // status, chosen headers, JSON body as a tree
	}

	[Test]
	[HttpFiles("http")]                                           // one test case per .http file
	public Task Run(SnapshotFile file) =>
		HttpFileTest.RunAsync(file, new HttpFileSnapshotOptions { Client = Client });
}

[HttpFiles] is in Nullean.Snapshots.TUnit. For WebApplicationFactory, give the runner a client that does not follow redirects, factory.CreateClient(new() { AllowAutoRedirect = false }), so # @no-redirect works per request; HttpFileTest.SkipReason says when a file does not apply.

Learn more

Changes from Previous Version

No structural changes between v0.17.0 and v0.18.0.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.