What is the best way to compare two similar objects?
Given FlintlockDTO and Flintlock:
public class FlintlockDTO
{
public string GName { get; set; }
public string SharedPropertyName { get; set; }
...
}
and
public class Flintlock
{
public Flintlock(FlintlockDTO inflator)
{
this.GoodName = inflator.GName;
this.SharedPropertyName = inflator.SharedPropertyName;
...
}
public string GoodName { get; private set; }
public string SharedPropertyName { get; private set; }
...
}
Where both classes share N properties (e.g. SharedPropertyName), but differ on M properties that are equivalent, but named differently (e.g. GoodName \ GName.)
Tools such as fluentassert nearly do this, if the property names matched, to my understanding this would work:
flintlockDto.ShouldBeEquivalentTo(flintlock);
Is there a way to do this neatly in fluentassert or any other tool?
Ideally,
flintlockDto.IsTheSameAs(flintlock).WhenMapping("GName","GoodName");