When "ToString" does not equal "ToString"
The following code fail in a test!
I’ve zero idea why this happened, or how it can happen.
[Test]
public void ReallyStrangeBug()
{
      HybridDictionary dic = new HybridDictionary();
      foreach(MemberInfo member in typeof(object).GetMembers(BindingFlags.Public | BindingFlags.Instance))
            dic.Add(member.Name,member);
      Assert.In("ToString",dic.Keys);
}
The Assert.In is this method:
static public void In(Object test, IEnumerable enumerable)
{
    Assert.IsNotNull(enumerable,"Enumerable collection is a null reference");
    foreach(Object o in enumerable)
    {
      if (o==test)
            return;
    }
    Assert.Fail("{0} not found in collection",test);
}  
}
I debugged it to o==test, and I can see in watch that the values are the same, but it just doesn’t work!!!
 

Comments
Comment preview