Combinatorial data in xUnit.NET?
Asked Answered
I

2

15

I'm migrating from MbUnit to xUnit, and I'm trying to locate the equivalent attributes (or approach) to MbUnit's [CombinatorialJoin] and [Column].

For example, when testing common behavior of a function with multiple boolean parameters, [Column] makes it very easy to test the permutations:

public void TestMethodWithTooManyOptions([Column(true, false)] bool dispose,
                                        [Column(true, false)] bool useDestinationStream,
                                        [Column(true, false)] bool useCorruptedSource,
                                        [Column(true, false)] bool loadTwice,
                                        [Column(true, false)] bool useSourceStream) {

[CombinatorialJoin], [SequentialJoin], [PairwiseJoin] affect how columns (or rows) are permuted.

Ionogen answered 10/9, 2014 at 14:30 Comment(1)
I'm doing the same thing now. Did you ever come up with a suitable solution?Multistage
V
19

This is perhaps a correct response...

https://github.com/AArnott/Xunit.Combinatorial

Ventricose answered 13/10, 2015 at 13:58 Comment(0)
D
1

If you use ApprovalTests, you can create an xUnit.net Fact and the CombinationApprovals.VerifyAllCombinations method to run combinatorial tests.

It's not the same as using an attribute, but it's the best solution I have found in xUnit.

Demers answered 17/7, 2015 at 13:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.