Legacy Documentation. View NUnit 3 Documentation

Samples

NUnit 2.4 has additional samples from previous versions. Samples are now organized by language, with an additional folder for Extensibility examples.

C# Samples

Failures
This sample written in C# demonstrates 4 failing unit tests and one test that is not run.
Money
This is a C# version of the money example which is found in most xUnit implementations. Thanks to Kent Beck.
Money-port
This is an example of the minimum amount of work that is needed to upgrade from previous versions of NUnit to this version.

J# Samples

Failures
This has three failing tests and one ignored test written in J#.

VB.NET Samples

Failures
This sample written in VB.NET demonstrates 4 failing unit tests and one test that is not run.
Money
This is a VB.NET version of the money example which is found in most xUnit implementations. Thanks to Kent Beck.

Managed C++ Samples

Failures
This is the same example as the others with four failing unit tests and one ignored test. NOTE:  The results are as expected when compiled in Debug mode. In Release mode the divide by zero test succeeds.

C++/CLI Samples

Failures
This is the same example as the others with four failing unit tests and one ignored test.

Extensibility Examples

Minimal
The smallest possible Addin: it does nothing but is recognized by NUnit and listed in the Addins dialog.
SampleSuiteExtension
A "toy" SuiteBuilder. It recognizes a special attribute and identifies tests right in the suite extension. This example uses separate objects for the addin and the suite builder.
SampleFixtureExtension
A slightly more involved SuiteBuilder. It recognizes a special attribute and registers a test case builder to identify its tests. It inherits from NUnitTestFixture and so gets all the features of that class as well for free. This example uses the same object to implement both the addin and the suite builder.