I have a mocked DTO class that has properties in it I'm setting via a callback function. This works below for me, but is there a cleaner way to go about it?
Mock<MyDto> _MyDto = new Mock<MyDto>();
_MyDto.Setup(dto => dto).Callback<MyDto>(dto =>
{
dto.FirstName = "John";
dto.LastName = "Doe";
});
I'd like to set those properties in the Setup
call if possible, but it accepts an expression and I can't do a multi-line statement in there. But my Linq knowledge isn't encyclopedic and I was wondering if there was a better to approach what I'm doing.