Provides a column of enumeration values as a data source.
Namespace:
MbUnit.FrameworkAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.459.0)
Syntax
| C# |
|---|
public class EnumDataAttribute : DataAttribute |
| Visual Basic (Declaration) |
|---|
Public Class EnumDataAttribute _ Inherits DataAttribute |
Remarks
Each value from the specified enumeration type is used as input for the data-driven test method.
It is possible to exclude some specific values of the enumeration from the column. Use Exclude or ExcludeArray for that purpose.
Examples
public enum Planet { Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune } [TestFixture] public class MyTestFixture { [Test] public void Test([EnumData(typeof(Planet))] Planet planet) { // This test will run 8 times with all the possible values of // the specified enumeration type. } [Test] public void TestWithRestrictions([EnumData(typeof(Planet), Exclude = Planet.Earth)] Planet planet) { // This test will run only 7 times. } }
Inheritance Hierarchy
System..::.Object
System..::.Attribute
Gallio.Framework.Pattern..::.PatternAttribute
Gallio.Framework.Pattern..::.DecoratorPatternAttribute
Gallio.Framework.Pattern..::.DataPatternAttribute
MbUnit.Framework..::.DataAttribute
MbUnit.Framework..::.EnumDataAttribute
System..::.Attribute
Gallio.Framework.Pattern..::.PatternAttribute
Gallio.Framework.Pattern..::.DecoratorPatternAttribute
Gallio.Framework.Pattern..::.DataPatternAttribute
MbUnit.Framework..::.DataAttribute
MbUnit.Framework..::.EnumDataAttribute
