In XUnit it is possible to have parametriesed unit tests (theories).
E.g.
[Theory]
[InlineData(1,2)]
[InlineData(2,4)]
[InlineData(-1,-2)]
public void DoublingWorks(int a, int b)
{
Assert.Equal(a+a,b);
}
However I can't see how change the name of the test, e.g. above I might like to make the name for the negative example "negative" to reflect it's different nature rather than being "DoublingWorks(a: -1, b: -2)". Is there a different type of attribute that I need to use to get this feature? Also can I selectively Ignore the test cases? Can I get it to work with the MemberDataAttribute too?
Aucun commentaire:
Enregistrer un commentaire