Skip to main content

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

Total Downloads
5.3K
5,321
Published
Nov 17, 2026
6d ago

Get Started

dotnet add package Nullean.Snapshots.Html --version 0.18.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

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

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.