The comparer doesn't work when object of derived class is used.
Ex:
public class BaseClass
{
public int Id {get; set;}
}
public class DerviedClass
{
public string Name {get; set;}
}
Comparer works when BaseClass property is different
var obj1 = new DerivedClass { Id = 1, Name = Foo };
var obj2 = new DerivedClass { Id = 2, Name = Foo };
var _comparer = new ObjectsComparer.Comparer<BaseClass>();
var equal = _comparer.Compare(obj1, obj2, out differencesList);
// equal is false
But when derived class property is different it doesn't
var obj1 = new DerivedClass { Id = 1, Name = Hello };
var obj2 = new DerivedClass { Id = 1, Name = Foo };
var _comparer = new ObjectsComparer.Comparer<BaseClass>();
var equal = _comparer.Compare(obj1, obj2, out differencesList);
// equal is true
The comparer doesn't work when object of derived class is used. Ex:
Comparer works when BaseClass property is different
But when derived class property is different it doesn't
Is this a issue of it's by design?