I want to execute one Test method several (3) times with different behaviour of a mocked object. So I can avoid writing multiple Test methods with mocked objects for each.
Code as example:
_mockObj.MockedMethod(Arg.Any<string>(), Arg.Any<string>()).Returns(new objA() { TestProp="bla1" };
_mockObj.MockedMethod(Arg.Any<string>(), Arg.Any<string>()).Returns(new objA() { TestProp="bla2" };
_mockObj.MockedMethod(Arg.Any<string>(), Arg.Any<string>()).Returns(new objA() { TestProp="bla3" };
What I want to do is by using one Test method to test the above 3 behaviours. Is this possible or do I have to write 3 separate Test methods?
EDIT
I've found that I have to use TestCaseSourceAttribute
. But now I'm facing another 'issue'. When I have a lot of TestCases and one of them fails, then I can't trace which one of the TestCases failed...