I have a unit test that behaves differently depending on parameters passed. Does VS 2010 MS Testing framework have a facility to call the same test with different parameters. I am looking for something like this:
[TestRun(False)]
[TestRun(True)]
[TestMethod]
public void FooTest(bool a)
{
RunTest(a);
}
I have no idea why Micosoft's decided not to include this feature in their unit testing framework, whenever I search for it I find reference to the DataSource attribute that enable loading data from external resource (XML file, data base etc.)
If you do not want to use and external data source then you have two choices:
If you're already using VS2010 I suggest you go with the first option - there is even a full working code at Microsoft's code gallery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With