'Integrate AutoMapper in my Unit Test doesn't work
My problem is that I am trying to add AutoMapper in my unit test, but I have one method that doesn't pass. I've tried to add to configure AutoMapper in the constructor, but it's still not working. I am not a pro in unit test, so can someone help me with this please.
public AssetControllerTest()
{
_loggerMock = new Mock<ILogger<AssetController>>();
_sqlService = new Mock<ISqlService>();
//_mapper = new Mock<IMapper>();
if (_mapper == null)
{
var mappingConfig = new MapperConfiguration(mc =>
{
mc.AddProfile(new AssetProfile());
});
IMapper mapper = mappingConfig.CreateMapper();
_mapper = new Mock<IMapper>();
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
