I\'m writing unit tests for ASP.NET MVC controller methods.
Those controllers have a dependency on IMapper
- an interface I\'ve created to abstract AutoMapp
I'm in favour of #2 like jeriley
Adding to the Moq, if you need to return an object based on values passed to it you can write your setup like so:
mockObject.Setup(x => x.MapObject(It.IsAny()) .Returns((ProductDto productDto) => { var product = new Product() { Id = productDto.Id, Name = productDto.Name }; return product });
Little bit messy but handy.