I'm not sure whether this is a bug. I have the following production code:
public class NothingClass
{
public int Gradient
{ get; set; }
public override bool Equals(object obj)
{
var nothingOther = (NothingClass) obj;
return Gradient == nothingOther.Gradient;
}
public override int GetHashCode()
{
return Gradient.GetHashCode();
}
}
And here's the test code:
[Test]
public void ToListTest()
{
var sw1 = new NothingClass();
CompareArrayList(sw1);
var sw2 = Isolate.Fake.Instance<NothingClass>();
CompareArrayList(sw2);
}
private static void CompareArrayList<T>(T sw1)
{
var swList = new List<T> {sw1};
var swArray = new[] {sw1};
Assert.AreEqual(swList[0], swArray.ToList()[0]);
}
This test will fail. But if I remove the Equals and GetHashCode in GetNothing, then it will pass.
Is this a bug?
________
Granny vid