Legacy Documentation. View NUnit 3 Documentation

Samples

The samples installed with NUnit continue to be 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.
Syntax
Illustrates use of most Assert methods using both the classic and constraint-based syntax in C#.

F# Samples

Failures
This sample written in F# demonstrates 4 failing unit tests and one test that is not run.
Money
This is a F# version of the money example which is found in most xUnit implementations. Thanks to Kent Beck.
Syntax
Illustrates use of most Assert methods using both the classic and constraint-based syntax in F#.

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.
Syntax
Illustrates use of most Assert methods using both the classic and constraint-based syntax in VB.NET.

C++ Samples

Failures
This is the same example as the others with four failing unit tests and one ignored test.
Syntax
Illustrates use of most Assert methods using both the classic and constraint-based syntax in C++.

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.