I want to test the following method in C# for all code paths.
public int foo (int x)
{
if(x == 1)
return 1;
if(x==2)
return 2;
else
return 0;
}
I've seen this pex unit testing where multiple inputs are tested. How can I create a unit test that accepts multiple inputs?
[TestMethod()] //some setup here??
public void fooTest()
{
//some assert
}
I want to avoid creating a test method for each input. I am working with Visual Studio 2010/2012 and .Net 4.0