2013-11-03 14:34:08 |
Charlie Poole |
description |
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
[TestFixture]
public class Reproduction {
class SelfContainer : IEnumerable { public IEnumerator GetEnumerator() { yield return this; } }
[Test]
public void SelfContainedItemFoundInArray() {
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
// work around
Assert.True(((ICollection<SelfContainer>)items).Contains(item));
// causes StackOverflowException
Assert.Contains(item, items);
}
}
Reproduced in NUnit 2.6.1
See also bug #491300 |
[Bug now tracked at https://github.com/nunit/nunit-framework/issues/52]
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
[TestFixture]
public class Reproduction {
class SelfContainer : IEnumerable { public IEnumerator GetEnumerator() { yield return this; } }
[Test]
public void SelfContainedItemFoundInArray() {
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
// work around
Assert.True(((ICollection<SelfContainer>)items).Contains(item));
// causes StackOverflowException
Assert.Contains(item, items);
}
}
Reproduced in NUnit 2.6.1
See also bug #491300 |
|