Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#846 NUnitEqualityComparer.StreamsE­qual fails for same stream

2.5
closed-fixed
Charlie Poole
framework (182)
5
2009-07-17
2009-07-13
Anonymous
No

When asserting a stream of non-zero length is equal to itself, NUnit
returns a failure because the comparer assumes it is two separate
references that it can read in parallel.

The following test incorrectly fails with:
NUnit.Framework.AssertionException: Stream lengths are both 3. Streams differ at offset 0.

[Test]
public void TestStreamsEqual()
{
Stream exampleStream = new MemoryStream(new byte[] {1, 2, 3});
Assert.That(exampleStream, Is.EqualTo(exampleStream));
}

Discussion

  • Charlie Poole
    Charlie Poole
    2009-07-17

    • status: open --> closed-fixed
     
  • Charlie Poole
    Charlie Poole
    2009-07-17

    Fixed in HEAD.

     
  • Charlie Poole
    Charlie Poole
    2009-07-17

    • assigned_to: nobody --> charliepoole