Skip to main content
net10.0net11.0

HTML snapshots and inline HTML assertions for Nullean.Snapshots: pretty-printed with AngleSharp, compared structurally with AngleSharp.Diffing.

Published
Nov 15, 2026
7d ago
Total Downloads
5.3K
5,321

Install

dotnet add package Nullean.Snapshots.Html --version 0.14.0
ProductVersions
.NET
net10.0net11.0

README

Nullean.Snapshots.Html

snapshots.

HTML snapshots and inline HTML assertions for Nullean.Snapshots: pretty-printed with AngleSharp and compared as a DOM, so whitespace and attribute order never fail a test.

NuGet

Install

dotnet add package Nullean.Snapshots.Html

Quick start

using AwesomeAssertions;
using Nullean.Snapshots.Html;

public class PageTests
{
	[Test]
	public void Renders()
	{
		var options = new HtmlSnapshotOptions()
			.Select("main#content")
			.Remove("script")
			.RemoveAttributes("hx-*", "nonce");
		Page.Render().Should().MatchHtmlSnapshot(options); // .verified.html, compared as a DOM
	}

	[Test]
	public void Greets() =>
		Page.Render().Should().ContainHtml("<p class=\"lead\">Welcome</p>");
}
  • MatchHtmlSnapshot stores .verified.html; MatchInlineHtmlSnapshot keeps the expected markup in the test.
  • BeHtml, ContainHtml and NotContainHtml compare with markup written in the test.
  • HtmlSnapshotOptions narrows what is printed: select, remove elements, remove attributes, then transforms, in that order. It parses markup only, with no scripts or browser.

Learn more

Changes from Previous Version

No structural changes between v0.13.0 and v0.14.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.