nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #03723
[Bug 1167638] Re: Incorrectly detected recursion with types implementing IEnumerable and overriding Equals/operators/value types
** Changed in: nunitv2
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1167638
Title:
Incorrectly detected recursion with types implementing IEnumerable and
overriding Equals/operators/value types
Status in NUnit V2 Test Framework:
Fix Released
Bug description:
Snipping from an email conversation
--------------------------------------------------------------------
I encountered a bug in NUnit 2.6. I have attempted to create an account on Launchpad, but that didn’t go well. In case you wish to hear about the bug regardless:
[Test]
public void Sanity()
{
CollectionAssert.AreEqual(
new[] {new Foo(true), new Foo(false),new Foo(false)},
new[] {new Foo(true), new Foo(false),new Foo(false)});
}
struct Foo : IEnumerable<bool>
{
public bool Value;
public Foo(bool value)
{
Value = value;
}
public IEnumerator<bool> GetEnumerator()
{
yield return Value;
}
IEnumerator IEnumerable.GetEnumerator()
{
yield return Value;
}
}
The test fails because Foo implements IEnumerable. Removing the interface makes the test pass.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1167638/+subscriptions
References