csUnit Class Library

csUnit Namespace

The csUnit namespace contains classes which are needed for implementing tests.

Namespace hierarchy

Classes

Class Description
Assert The Assert class is used in test methods to assert a known condition. For instance, after running some logic, to assert that a result variable has an expected value, use the
Assert.Equals
method.
ExpectedExceptionAttribute The ExpectedExceptionAttribute can be used to mark a test, so that when no exception of a particular type has been thrown, the test will be reported as failed. Only if the exact exception type has been thrown, the test will pass, unless the IsRequired parameter is set to 'false'.
FixtureSetUpAttribute A method in a test fixture tagged with the FixtureSetUpAttribute will be called once before running all the tests in the test fixture.
FixtureTearDownAttribute A method in a test fixture tagged with the FixtureTearDownAttribute will be called once after running all the tests in the test fixture.
IgnoreAttribute The IgnoreAttribute can be used to mark a test fixture or a test. When marked this way, the test or the entire test fixture will not be excuted when the tests are run.
SetUpAttribute A method in a test fixture tagged with the SetUpAttribute will be executed immediately before each test. The method must have the type 'public void' and it must no take any parameters.
TearDownAttribute A method tagged with the TearDownAttribute will be called immediately after the execution of each single test. The method must have the type 'public void' and must not take any parameter.
TestAssemblyFixtureAttribute Use the TestAssemblyFixtureAttribute to decorate a class which contains setup and teardown methods for an assembly. Apply it to only one class, as the runtime will pick up only the first one it finds. The setup method needs to be marked with the . The teardown method requires the .
TestAttribute A method tagged with the TestAttribute will be identified as a test within a testfixture. The method must be of type 'public void' and it must not take any parameter.
TestFailed TestFailed is an exception that will be thrown when a test has failed, that is when an assertion has failed. This is opposed to an TestError exception, which indicates an error such as a division by zero.
TestFixtureAttribute A public class with the TestFixtureAttribute set will be identified as a test fixture.