Open asimon-od opened 11 months ago
It sounds interesting. The combinatorial algorithm is very complex, and I just copied it from NUnit. I'm not sure how easily adaptable it would be to this idea. I think your proposed API would need a little adjusting as well. But if you have time and interest to give it a try, let me know and I'll assign the issue to you. Otherwise I may close the issue as I don't foresee ever having the time to deliver on this myself.
@asimon-od For now, the workaround for your scenario is to use tuples. Works perfectly although I do understand your request for it to be part of the base API of the library.
[Theory, CombinatorialData]
public void Example([CombinatorialMemberData(nameof(GetIntegerData))](int, int) integerData, bool c)
{
// body
}
private static IEnumerable<(int, int)> GetIntegerData()
{
yield return (10, 0);
yield return (5, 2);
}
Essentially, I'm looking to be able to hand write values for some test parameters while combinatorially populating others. This would allow more control over e.g.
int
values than the existing range options or the veto option proposed in #3.An (albeit useless) toy example:
In this example, the values for
a
andb
are hand-picked, but should be tested for both values ofc
. I assume it may not be possible to build this functionality on top of the existingInlineData
attribute, but supposing a new keyword-style equivalent that replaced any omitted parameters with their combinatorial definitions, it could look like this:and could also support cases where we don't want the combinatorics a la #3