admin管理员组文章数量:1566356
System.InvalidOperationException:“Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.”
Here is the code for the method that I'm developing the unit test for:
Following is the code from the mapping configuration file:
And I have initialized mapper in the
Below is the simple test method that I'm trying to run:
It works fine when I simply run the application. But when I try to run the unit test method, it shows the mentioned error message. Can anyone help me to get over this issue? Thanks! c# asp-mvc unit-testing automapper
| |||||||||||||
|
1 Answer
active oldest votesup vote 3down voteaccepted |
You need to create/register the mappings for your unit tests as well as the
In the above test the mapping configuration is done in a method decorated with
|
转载于:https://wwwblogs/endv/p/6896608.html
本文标签: initializedmapperCallconfigurationinitialize
版权声明:本文标题:Mapper not initialized. Call Initialize with appropriate configuration. 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1726298249a1064857.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论