if i have a extension method that converts an Person
object to a PersonDTO
then
- should i unit test that the conversion occurs correctly
- if so and i use
fluentassertions
how do i assert that the conversion is correct
my extension method is:
public static PersonDTO ToDto (this Person person)
{
if (person == null) return null;
return new PersonDTO
{
FirstName = person.FirstName,
LastName = person.LastName,
Dob = person.Dob,
Identifier= person.Id
};
}
my person object has other properties that are not being mapped.
to get the personDTO object i would therefore do something similar to below:
var newPerson = new Person{ //set properties here };
var personDto = newPerson.ToDto();