I have an application in .net core in which I am using automapper in one of my service. Now the issue is I am writing test method and mocking automapper but it is returning null. Here is the service method:
var users = _mapper.Map<IList<User>>(data);
and here is mocking using Moq:
var userLogsList = new List<User>() { new User() {Id = "1234", Name= "Dummy User"}};
var mapperMock = new Mock<IMapper>();
mapperMock.Setup(m => m.Map<List<UserEntity>, IList<User>>(It.IsAny<List<UserEntity>>()))
.Returns(userLogsList);
Now this mock returining null everytime. What am i doing wrong?