Table of Contents

Class TestFixtureAttribute

Namespace
NUnit.Framework
Assembly
nunit.framework.dll
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class TestFixtureAttribute : FixtureBuilderAttribute, IFixtureBuilder, IApplyToTest
Inheritance
TestFixtureAttribute
Implements
Inherited Members

Examples

[TestFixture] public class ExampleClass {}

Constructors

TestFixtureAttribute()

Default constructor

public TestFixtureAttribute()

TestFixtureAttribute(params object[])

Construct with a object[] representing a set of arguments. In .NET 2.0, the arguments may later be separated into type arguments and constructor arguments.

public TestFixtureAttribute(params object[] arguments)

Parameters

arguments object[]

Properties

Arguments

The arguments originally provided to the attribute

public object[] Arguments { get; }

Property Value

object[]

Author

The author of this fixture

public string Author { get; set; }

Property Value

string

Categories

Gets a list of categories for this fixture

public IList Categories { get; }

Property Value

IList

Category

Gets and sets the category for this fixture. May be a comma-separated list of categories.

public string Category { get; set; }

Property Value

string

Description

Descriptive text for this fixture

public string Description { get; set; }

Property Value

string

Ignore

Gets or sets a value indicating whether this TestFixtureAttribute should be ignored.

public bool Ignore { get; set; }

Property Value

bool

true if ignore; otherwise, false.

IgnoreReason

Gets or sets the ignore reason. May set Ignored as a side effect.

public string IgnoreReason { get; set; }

Property Value

string

The ignore reason.

TestOf

The type that this fixture is testing

public Type TestOf { get; set; }

Property Value

Type

TypeArgs

Get or set the type arguments. If not set explicitly, any leading arguments that are Types are taken as type arguments.

public Type[] TypeArgs { get; set; }

Property Value

Type[]

Methods

ApplyToTest(Test)

Modifies a test by adding a description, if not already set.

public void ApplyToTest(Test test)

Parameters

test Test

The test to modify

BuildFrom(Type)

Build a SetUpFixture from type provided. Normally called for a Type on which the attribute has been placed.

public TestSuite BuildFrom(Type type)

Parameters

type Type

The type of the fixture to be used.

Returns

TestSuite

A SetUpFixture object as a TestSuite.