← Back to team overview

nunit-core team mailing list archive

[Bug 1186689] [NEW] Assert.AreEqual dosn't works correctly for IEnumerable targets

 

Public bug reported:

Hi!

I've a class that implements IEnumerable interface and overrides the
Eqauls(object obj) method. For this class Assert.AreEqual(object
expected, object actual) doesn't calls overridden Equals method.

I investigate this issue by source code. I see that method

private bool AreEqual(object x, object y, EnumerableRecursionHelper
recursionHelper, ref Tolerance tolerance)

defined in NUnitEqualityComparer doesn't calls Equals method of object
if it implements IEnumerable.

I think it will be better if any special comparison will be called after
calling Equals and last one returns false value.

Thanks,
Sergey

** Affects: nunitv2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1186689

Title:
  Assert.AreEqual dosn't works correctly for IEnumerable targets

Status in NUnit V2 Test Framework:
  New

Bug description:
  Hi!

  I've a class that implements IEnumerable interface and overrides the
  Eqauls(object obj) method. For this class Assert.AreEqual(object
  expected, object actual) doesn't calls overridden Equals method.

  I investigate this issue by source code. I see that method

  private bool AreEqual(object x, object y, EnumerableRecursionHelper
  recursionHelper, ref Tolerance tolerance)

  defined in NUnitEqualityComparer doesn't calls Equals method of object
  if it implements IEnumerable.

  I think it will be better if any special comparison will be called
  after calling Equals and last one returns false value.

  Thanks,
  Sergey

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1186689/+subscriptions


Follow ups

References