I'm trying to run some tests to check my postfix bitwise algorithm with XUnit. It seemed like a [Theory] with [InlineData] would work perfectly for this, but it does not appear to be working like I was hoping.
[Theory]
// a && b
[InlineData(new object[] { false, false, BitwiseOperator.And }, false)]
[InlineData(new object[] { true, false, BitwiseOperator.And }, false)]
[InlineData(new object[] { false, true, BitwiseOperator.And }, false)]
[InlineData(new object[] { true, true, BitwiseOperator.And }, true)]
public void Test(IEnumerable<object> tokenPrimitives, bool expectedResult)
{
//Run test
}
When the the NCrunch test runner (or does this use Visual Studio test runner?) scans for tests, it only picks out two tests from the four [InlineData]. It always seems to be one with expectedResult = false and one with expectedResult = true. At a glance, it seems as if the scanner is treating all tests with expectedResult = false as being equal, and thus ignoring the other two.
So my question is: can I use [InlineData] for this, and if so how? Otherwise I am open to ideas. I've been trying to experiment with [MemberData], but I've had similar frustrations. It appears to run all my tests, but the console only displays one test instead of 4, which makes it difficult to figure out which test fails. I've found a solution to this in a different Stackoverflow question, but I've yet to get it to work for this scenario.