0

How can I annotate my MBUnit test with a test data source attribute like in NUnit:

Pseudocode like its in NUnit:

[TestCaseSource("GetData")]
public void Test(int value)
{

}

private static IEnumerable<int> GetData()
{
   yield return 1;
   yield return 2;
   yield return 3;   
}
Elisabeth
  • 20,496
  • 52
  • 200
  • 321

1 Answers1

1

MbUnit supports a variety of test data sources using attributes. Refer to MBUnit documentation wiki.

Your NUnit example can be reimplemented in MBUnit using following syntax:

[TestFixture]
public class SampleFixture
{
  public IEnumerable<int> GetData()
  {
    yield return 1;
    yield return 2;
    yield return 3;
  }

  [Test, Factory("GetData")]
  public void Test(int value)
  {
  }
}
Alexander
  • 4,153
  • 1
  • 24
  • 37