Jan 03

XUnit: NotEqual messes parameter order

Posted in Trivia      Comments Off on XUnit: NotEqual messes parameter order

I”ve been using XUnit in my last project and I must say that I”m pretty excited with it. Besides letting me throw in the “correct place” (ie, no more ExpectedExceptionAttribute!), I”m really enjoying its simplicity. Unfortunately, there are still some bugs that need to be solved. Today I”ve just tripped on what I think is a bug: NotEqual messes the parameter order.

If you go through the docs, you”ll see that it supports the NotEqual supports the following overloads:

NotEqual<T>(T, T)
NotEqual<T>(T, T, IComparer<T>)
NotEqual<T>(T, T, String)
NotEqual<T>(T, T, IComparer<T>,String)

The blame lies on the version that is bolder:

public static void NotEqual<T>(T expected,T actual, IComparer<T> comparer)
    NotEqual<T>(actual, expected, comparer, null);

As you can see, the method is changing the order of the parameters and this is messing all mye NotEqual tests where I”m not passing a comparer and a string! Lets hope it gets fixed before the next version is released.