Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

GrahamTheCoder/Assertion-Source-Info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ℹ️ NUnit has now integrated this functionality, so I'm archiving the repo

Assertion-Source-Info

Adds the statement which caused the assertion failure to the assertion error message.

Example

Assert.That("baboon".IndexOf("boo"), Is.EqualTo(3));

The normal NUnit message would be of the form:

Expected 3 but was 2

With this test helper it's of the form:

In: Assert.That("baboon".IndexOf("boo"), Is.EqualTo(3)); Expected 3 but was 2

How to use with NUnit

[SetUpFixture]
public class AssemblySetUp
{
	[SetUp]
	public void SetUp()
	{
		Gtc.AssertionSourceInfo.AssertionImproverFixtureSetup.Install();
	}
	
	[TearDown]
	public void TearDown()
	{
		Gtc.AssertionSourceInfo.AssertionImproverFixtureSetup.Uninstall();
	}
}

About

Adds the statement which caused the assertion failure to the assertion error message

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published