/ApprovalTests.Net

ApprovalTest verification library for .Net

Primary LanguageC#OtherNOASSERTION

ApprovalTests

Capturing Human Intelligence - ApprovalTests is an open source assertion/verification library to aid unit testing.

It is compatiable with most .Net unit testing frameworks (Nunit, MsTest, Xunit, MBUnit)

What can it be used for?

Approval Tests can be used for verifing objects that require more than a simple assert. They also come prepackaged with utilities for some common .Net scenarios including

  • Dictionaries & Collections
  • Long Strings
  • Log Files
  • Asp.Net
  • Asp.Net Mvc
  • Winforms
  • Wpf
  • Enitity Framework
  • Rdlc reports

Video Tutorials

You can watch a bunch of short videos on getting started and using ApprovalTests in .Net at youtube

Podcasts

If you prefer auditory learning, you might enjoy the following podcast

Available on NuGet

Install-Package ApprovalTests

Examples

Sample Code

[UseReporter(typeof(DiffReporter))]
[TestFixture]
public class SampleTest
{
	[Test]
	public void TestList()
	{
		var names = new[] {"Llewellyn", "James", "Dan", "Jason", "Katrina"};
		Array.Sort(names);
		Approvals.VerifyAll(names, "");
	}
}

Will Produce a File

SampleTest.TestList.recieved.txt
[0] = Dan
[1] = James
[2] = Jason
[3] = Katrina
[4] = Llewellyn

Simply rename this to SampleTest.TestList.approved.txt and the test will now pass.

More Info

LICENSE

Apache 2.0 License

Questions?

twitter: @LlewellynFalco or #ApprovalTests