Describes a test generated either at test exploration time or at test execution time by a test factory.

Namespace:  MbUnit.Framework
Assembly:  MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)

Syntax

C#
public abstract class Test
Visual Basic (Declaration)
Public MustInherit Class Test

Remarks

Tests can be nested to form test suites and other aggregates.

Examples

Produces a suite of static tests as part of a containing test fixture. The suite includes some custom set-up and tear-down behavior, metadata, a timeout, an order relative to the other tests in the fixture, and a list of children. There are two test cases defined in line, and one reference to another statically defined test elsewhere.

CopyC#
[StaticTestFactory]
public static IEnumerable<Test> TestSuite()
{
    yield return new TestSuite("My Suite")
    {
        Description = "An example test suite.",
        Metadata =
        {
            { MetadataKeys.AuthorName, "Me" },
            { MetadataKeys.AuthorEmail, "me@mycompany.com" }
        },
        SuiteSetUp = () => DatabaseUtils.SetUpDatabase(),
        SuiteTearDown = () => DatabaseUtils.TearDownDatabase(),
        Timeout = TimeSpan.FromMinutes(2),
        Children =
        {
            new TestCase("Test 1", () => {
                // first test in suite
            }),
            new TestCase("Test 2", () => {
               // second test in suite
            }),
            new TestFixtureReference(typeof(OtherFixtureToIncludeInSuite))
        }
    };
}

Inheritance Hierarchy

System..::.Object
  MbUnit.Framework..::.Test
    MbUnit.Framework..::.TestDefinition
    MbUnit.Framework..::.TestFixtureReference

See Also