It is possible to pass in data to a unit test using the DataRow attribute (in combination with the DataTestMethod attribute). However, I want to know if it is possible to pass in data to named parameters of the unit test.
For example, I would currently have to do:
[DataTestMethod]
[DataRow(1, null, 3)]
public void MyTest(int? first = null, int? second = null, int? third = null)
{
// Test stuff...
}
Whereas, I would like to be able to:
[DataTestMethod]
[DataRow(first: 1, third: 3)]
public void MyTest(int? first = null, int? second = null, int? third = null)
{
// Test stuff...
}
I'm aware that this syntax is not 'feasible', it is more like pseudo code to convey my question.
I want to know if it is possible to pass in data to named parameters of the unit test.
No, passing named parameters is not an available feature in the current version of MSTest.
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