I'm using Fluent Assertions to Validate to different test Objects
public class DTO
{
public int Key {get; set;}
public string Code { get; set; }
}
public class KeyDTO
{
public int Id {get; set;}
public string Code { get; set; }
}
Note: this is not an exact replica of the code there are more field in the Original DTO but they're not necessary to explain the problems
I'm creating a function to assert that they are equal I'm trying use fluent assertions to do so. I Can't figure out a way to say that the Id Maps To the Key.
public void AssertDTOsAreEqual( List<DTO> orderedDTOs, List<KeyDTO> orderedKeys)
{
orderedDTOs.ShouldAllBeEquivalentTo(orderedKeys, o => o/*??*/)
}
Note: I Know as an alternative I can do this by zipping the ordered collections and comparing each property, but for more lengthy DTO's this would be trouble doing compairisons for each property.
Does anyone know of a way to map different properties in the ShouldAllBeEquivalentTo. Or Perhaps a better way to do this in general?