The data pattern attribute applies a data source to a fixture or test parameter declaratively.

Namespace:  Gallio.Framework.Pattern
Assembly:  Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.459.0)

Syntax

C#
public abstract class DataPatternAttribute : DecoratorPatternAttribute
Visual Basic (Declaration)
Public MustInherit Class DataPatternAttribute _
	Inherits DecoratorPatternAttribute

Remarks

It can be attached to a fixture class, a public property or field of a fixture, a test method or a test method parameter. When attached to a property or field of a fixture, implies that the property or field is a fixture parameter (so the TestParameterPatternAttribute may be omitted).

The order in which items contributed by a data pattern attribute are use can be controlled via the Order property. The contents of data sets with lower order indices are processed before those with higher indices.

Examples

The following example ensures that the rows are processed in exactly the order they appear.
CopyC#
[TestFixture]
public class Fixture
{
    [Test]
    [Row(1, "a"), Order=1)]
    [Row(2, "b"), Order=2)]
    [Row(3, "c"), Order=3)]
    public void Test(int x, string y) 
    { 
        // Code logic here...
    }
}

Inheritance Hierarchy

See Also