Reputation: 4999
Years ago there was, If I am not mistaken was to have one test method and take parameters in through the method, and these params would be setup with Moq and each diff set of params would create a new test
I cant remember what it was called and I have been searching for a while to find it but cant seem to find it I simple want to do
Moq("john", "mike", "sheila")
Moq("jake", "bleh", "donny")
....
[Test]
public void Test(param1, param2, param2)
{
...
}
Upvotes: 2
Views: 1805
Reputation: 19232
You can do this directly with NUnit, using TestCase
to have parameterized tests:
[TestCase("john", "mike", "Sheila")]
[TestCase("jake", "bleh", "donny")]
public void Test(string param1, string param2, string param3)
{
//...
}
Upvotes: 2
Reputation: 24569
Moq is mocking framework for .NET.
This functionality is not related to Moq, it depends of unit testing tool. So, if you're using xUnit then
[Theory]
[InlineData("john", "mike", "sheila")]
[InlineData("jake", "bleh", "donny")]
public void Test(string param1, string param2, string param3)
{
}
If you are using MSTest then add the packages MsTest.TestAdapter and MsTest.TestFramework
[DataTestMethod]
[DataRow("john", "mike", "sheila")]
[DataRow("jake", "bleh", "donny")]
public void Test(string param1, string param2, string param3)
{
}
Upvotes: 2