Skip to content
Robert Wagner edited this page Apr 15, 2021 · 8 revisions

Assent is a simple assertion library for long strings. By default it uses common diff tools to report on and resolve test failures.

It is test framework agnostic and works with .NET Framework 4.5, NET Standard 1.3 and .NET Core 1.0.

Installation

Install the package from nuget by adding Assent to your project.json dependencies or running install-package Assent from the NuGet tool window.

Getting Started

In your test, do your usual setup and execution, but replace your assert line with:

this.Assent("String To Assert")

To customise the behaviour:

var configuration = new Configuration()
	.UsingExtension(".json")

this.Assent("String To Assert", configuration)

You can use your favourite assertion library, see the Comparer page for details.

Automated Builds

Having a diff tool pop up during an automated build is not ideal, so it can be disabled by setting the AssentNonInteractive environment variable to true.

The Engine.IsNonInteractive static property can be used to see if this variable is set from within your tests or helpers.

Clone this wiki locally