1

Closed

Assert.Equal with IEnumerable fails after matching entire sequence

description

I have two IEnumerable<string>s that contain the same data. However, they are provided by two different functions so their type doesn't match, and I think that is confusing Assert.Equal. Here is a quick repro case:

(moved to http://pastebin.com/nBa5wYik due to codeplex formatting fail)

Results:

UnitTests.MyTests.FailingTest[FAIL]
 Assert.Equal() Failure
 Position: First difference is at position 15
 Expected: UnitTests.MyTests+<Flatten>d__1e`1[System.String]
 Actual:   System.Linq.Enumerable+<SelectManyIterator>d__14`2[System.Collections.Generic.IEnumerable`1[System.String],System.String]
It is entirely possible that this is as designed, since the two types don't match, but I would argue that if I'm testing two IEnumerables, I care more about their contents and not where they came from.
Closed Jul 4, 2012 at 6:15 PM by BradWilson
Already fixed in 1.9.

comments

bartelink wrote Feb 6, 2012 at 10:51 PM

What version? (There have been recent changes going from 1.8 to 1.9)

moswald wrote Feb 7, 2012 at 5:47 PM

Ah, sorry. I didn't realize this project hadn't updated to the 1.9 nuget package. All clear.