← Back to team overview

nunit-core team mailing list archive

[Bug 400502] Re: NUnitEqualityComparer.StreamsE­qual fails for same stream

 

** Changed in: nunit-3.0
   Importance: Undecided => Medium

** Changed in: nunit-3.0
       Status: New => Confirmed

** Changed in: nunit-3.0
    Milestone: None => 2.9.1

** Changed in: nunit-3.0
     Assignee: (unassigned) => Charlie Poole (charlie.poole)

-- 
NUnitEqualityComparer.StreamsE­qual fails for same stream
https://bugs.launchpad.net/bugs/400502
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.

Status in NUnit Test Framework: Confirmed

Bug description:
Bug Reported and fixed in NUnit 2.5 series:

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));
}



References