Table of Contents

Class TheoryAttribute

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

Adding this attribute to a method within a TestFixtureAttribute class makes the method callable from the NUnit test runner. There is a property called Description which is optional which you can provide a more detailed test description. This class cannot be inherited.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class TheoryAttribute : TestCaseBuilderAttribute, ITestBuilder, IImplyFixture
Inheritance
TheoryAttribute
Implements
Inherited Members

Examples

[TestFixture] public class Fixture { [Test] public void MethodToTest() {}

[Test(Description = "more detailed description")] publc void TestDescriptionMethod() {} }

Constructors

TheoryAttribute()

public TheoryAttribute()

Methods

BuildFrom(MethodInfo, Test)

Construct one or more TestMethods from a given MethodInfo, using available parameter data.

public IEnumerable<TestMethod> BuildFrom(MethodInfo method, Test suite)

Parameters

method MethodInfo

The MethodInfo for which tests are to be constructed.

suite Test

The suite to which the tests will be added.

Returns

IEnumerable<TestMethod>

One or more TestMethods