ApprovalTest verification library for .Net
C# ASP CSS Other
Latest commit a12ffad Mar 8, 2017 @jamesrcounts jamesrcounts committed on GitHub Merge pull request #182 from 304NotModified/TortoiseGitMerge-support
Add support for TortoiseGitMerge as Reporter
Permalink
Failed to load latest commit information.
.nuget annother mis-cased nuget Aug 28, 2015
.vs/config Some cleanup Sep 24, 2015
ApprovalTests.MSTest update EF Aug 2, 2016
ApprovalTests.MSpec Remove unused dependencies. May 20, 2016
ApprovalTests.MachineSpecific.Tests moving to vs2015 Sep 22, 2016
ApprovalTests.MbUnit Remove unused dependencies. May 20, 2016
ApprovalTests.Tests Fixed issues with Abonded files Feb 24, 2017
ApprovalTests.Xunit Improve support of xunit2 Oct 27, 2016
ApprovalTests.Xunit2 Improve support of xunit2 Oct 27, 2016
ApprovalTests Merge pull request #182 from 304NotModified/TortoiseGitMerge-support Mar 8, 2017
ApprovalUtilities.Net45 Remove unused dependencies. May 20, 2016
ApprovalUtilities.Tests Fix misspelled method name Jan 14, 2017
ApprovalUtilities Set EditorBrowsable to Never for obsolete method Jan 22, 2017
Asp.Net.Demo Move Package Jun 17, 2014
Common Added Reporters, External Images to RDLC, w/jim Jul 8, 2013
Docs/Images Image Jun 17, 2014
MvcApplication.Razor mvc sucks w/jim Jul 2, 2015
NeedsRepair/ApprovalTests.Silverlight.Tests configured git for binary files May 18, 2013
ReportingDemo Remove unused dependencies. May 20, 2016
build MyGet support files/changes Nov 27, 2013
lib/ReportViewer MyGet support files/changes Nov 27, 2013
packages Xunit 2 support Mar 23, 2015
.gitattributes small update + tfs support for lazy loaders w/jim Oct 1, 2013
.gitignore adding xamarin studio ignores to gitignore Aug 27, 2015
.travis.yml trying to enable nuget Aug 28, 2015
ApprovalTests.build Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.ncrunchsolution Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.properties.example Inital Transfer from sourceforge Jan 24, 2013
ApprovalTests.sln Splitting into Approvals.Asp w/@jason-kerney Oct 9, 2015
ApprovalTests.sln.DotSettings Bugfix and cleanup Dec 6, 2014
ApprovalTests.vsmdi Inital Transfer from sourceforge Jan 24, 2013
ApprovalsKeyPair.snk Changing nuget packing w/simon May 25, 2013
CreateNuget.cmd v 13 Sep 27, 2016
DeployToNuget.cmd v10 Oct 10, 2015
LICENSE.md Starting Documentation Jan 24, 2013
LocalTestRun.testrunconfig Inital Transfer from sourceforge Jan 24, 2013
MyGet.cmd Changed the build order Feb 16, 2015
VersionInfo.cs v 13 Sep 27, 2016
readme.md Update readme.md Feb 16, 2015

readme.md

ApprovalTests

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

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

What can it be used for?

Approval Tests can be used for verifying 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
  • Entity 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

Nightly (CI) Builds available at myget.org:

ApprovalTests Nightly Build Status

ApprovalTests on the MyGet Gallery Note: Select "Include Prerelease" instead of "Stable Only" (-IncludePrerelease in powershell)

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.received.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.

Approved File Artifacts

The *.approved.* files must be checked into source your source control. ApprovalTests now ignores line endings by default (so you can remove *.approved.* binary from your .gitattributes file if you added previously).

If you would like to verify line endings, simply add [assembly: IgnoreLineEndingsAttribute(false)] to your AssemblyInfo.cs

Do not add *.received.* files to your source control (they are transitory, and some SCMs like TFS will lock them or mark them read-only, which will break every dependent test).

More Info

LICENSE

Apache 2.0 License

Questions?

ask on twitter: @LlewellynFalco or #ApprovalTests