I have a public extension method that looks like this:
Code:
public static T MinOrDefault <T>(this IEnumerable<T> source, T defaultValue = default(T))
{
return MinOrDefaultImplementation(source, defaultValue);
}
I have an NUnit unit test that looks like this:
Code:
[Test]
public void MinOrDefault_OnEmptyGenericEnumerable_ReturnsDefault()
{
var emptyGenericEnumerable = Enumerable.Empty<object>();
Assert.That(() => emptyGenericEnumerable.MinOrDefault(), Is.EqualTo(default(object)));
}
This test is failing in NCrunch, however when I run it with ReSharper's TestRunner it passes.
NCrunch states this:
Expected: null
But was: <System.Reflection.Missing>
I have tested using many other classes for the generic Enumerable.Empty with this and it seems to work, just not for System.Object.
Not sure if this is a bug or a known issue or what? Let me know if you need more info.
Thanks.