1 // this is a template for making NUnit version 2 tests. Text enclosed in curly
2 // brackets (and the brackets themselves) should be replaced by appropriate
5 // {File Name}.cs - NUnit Test Cases for {explain here}
7 // {Author Name} ({Author email Address})
9 // (C) {Copyright holder}
12 // these are the standard namespaces you will need. You may need to add more
13 // depending on your tests.
14 using NUnit
.Framework
;
17 // all test namespaces start with "MonoTests." Append the Namespace that
18 // contains the class you are testing, e.g. MonoTests.System.Collections
19 namespace MonoTests
.{Namespace}
22 // the class name should end with "Test" and start with the name of the class
23 // you are testing, e.g. CollectionBaseTest
25 public class {Class to be tested}Test
: Assertion
{
27 // this method is run before each [Test] method is called. You can put
28 // variable initialization, etc. here that is common to each test.
29 // Just leave the method empty if you don't need to use it.
30 // The name of the method does not matter; the attribute does.
32 public void GetReady() {}
34 // this method is run after each Test* method is called. You can put
35 // clean-up code, etc. here. Whatever needs to be done after each test.
36 // Just leave the method empty if you don't need to use it.
37 // The name of the method does not matter; the attribute does.
39 public void Clean() {}
41 // this is just one of probably many test methods in your test class.
42 // each test method must be adorned with [Test]. All methods in your class
43 // adorned with [Test] will be automagically called by the NUnit
46 public void {Something}
{
47 // inside here you will exercise your class and then call Assert()
50 // An nice way to test for exceptions the class under test should
54 [ExpectedException(typeof(ArgumentNullException))]
55 public void OnValid() {
56 ConcreteCollection myCollection;
57 myCollection = new ConcreteCollection();
59 AssertEquals ("#UniqueID", expected, actual);