Mapper not initialized. Call Initialize with appropriate configuration.
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! |
|||||||||||||
|
|
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
|
Mapper not initialized. Call Initialize with appropriate configuration.的更多相关文章
- 【问题】关于Mapper not initialized的问题
ERROR -- ::, [ ] nHandling.AbpApiExceptionFilterAttribute - Mapper not initialized. Call Initialize ...
- ABP+AdminLTE+Bootstrap Table权限管理系统第七节--登录逻辑及abp封装的Javascript函数库
经过前几节,我们已经解决数据库,模型,DTO,控制器和注入等问题.那么再来看一下登录逻辑.这里算是前面几节的一个初次试水. 首先我们数据库已经有的相应的数据. 模型和DTO已经建好,所以我们直接在服务 ...
- BDD实战篇 - .NET Core里跑Specflow - 可以跑集成测试和单元测试
这是<如何用ABP框架快速完成项目 >系列中和DevOps系列文章其中一篇文章. BDD很赞!比TDD先进很多,能够大大提高编码效率. 上一篇文章说了如何在.NET Core里安装 ...
- ABP+AdminLTE+Bootstrap Table权限管理系统第七节--登录逻辑及几种abp封装的Javascript函数库
返回总目录:ABP+AdminLTE+Bootstrap Table权限管理系统一期 简介 经过前几节,我们已经解决数据库,模型,DTO,控制器和注入等问题.那么再来看一下登录逻辑.这 ...
- .NET Core 中依赖注入 AutoMapper 小记
最近在 review 代码时发现同事没有像其他项目那样使用 AutoMapper.Mapper.Initialize() 静态方法配置映射,而是使用了依赖注入 IMapper 接口的方式 servic ...
- Document root element "configuration", must match DOCTYPE root "mapper".
最近剛剛鼓搗mybatis , 第一個demo就出了問題.其實原因是因為將mapper中的頭copy到了configuration里去了 <?xml version="1.0" ...
- WARN [main] conf.HiveConf (HiveConf.java:initialize(1488)) - DEPRECATED
问题描述:hive 关于告警问题的解决:WARN [main] conf.HiveConf (HiveConf.java:initialize(1488)) - DEPRECATED: Config ...
- myBatis源码之Configuration
Configuration类主要是用来存储对mybatis的配置文件及mapper文件解析后的数据,Configuration对象会贯穿整个myabtis的执行流程,为mybatis的执行过程提供必要 ...
- Mybatis Mapper接口是如何找到实现类的-源码分析
KeyWords: Mybatis 原理,源码,Mybatis Mapper 接口实现类,代理模式,动态代理,Java动态代理,Proxy.newProxyInstance,Mapper 映射,Map ...
随机推荐
- WebMail
try { WebMail.SmtpServer = "smtp.example.com"; WebMail.SmtpPort = ; WebMail.Enab ...
- CSS优先级问题以及jQuery中的.eq()遍历方法和:eq()选择器的差别
在写一个TAB选项卡的时候遇到几个有意思的问题,记录下来 先把代码贴出来 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transition ...
- vue验证码组件
1.效果图 2.全部代码: <template> <div class="join_formitem"> <label class="enq ...
- 缓存(LruCache)机制
LruCache 1.变量 private final LinkedHashMap<K, V> map; private int size;//已经存储的数据大小 private int ...
- Java-多线程编程(一)
创建多线程 [Thread class]1.继承Thread类,重写run() [Runnable接口]2.实现Runnable接口,重写run() [*Callable接口]3.实现Callable ...
- apue第16章笔记
intel 都是小端,小端即最低有效字节在最低地址上. tcp/ip协议栈使用大端字节序. connect失败可能是一瞬时的,用指数补偿算法处理,exponential backoff.但是在bsd套 ...
- 26、Flask实战第26天:cms用户模型定义
编辑cms.models.py from exts import db from datetime import datetime class CMSUser(db.Model): __tablena ...
- Server SQL 2008 练习
一.修改数据库 (1)给db_temp数据库添加一个数据文件文件db_temp1指定大小为5MB,最大文件大小为100mb,自动递增大小为1MB,存储路径为d:\. 利用系统存储过程sp_helpdb ...
- [BZOJ4819][SDOI2017]新生舞会(分数规划+费用流,KM)
4819: [Sdoi2017]新生舞会 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1097 Solved: 566[Submit][Statu ...
- 【深度搜索+剪枝】POJ2362-Square
从昨天晚上写到现在,一直在TLE,现在终于剪枝完成了_(:зゝ∠)_ [思路] 深搜:用这类型组合题目最基本的深搜,变量side记录当成已经组成了几条变,sl表示当前在组合的边已经有的长度.如果当前s ...
