将Abp的UnitTest中的InMemory改为SQLite in memory
添加nuget包
Microsoft.EntityFrameworkCore.Sqlite
添加ServiceCollectionRegistrarSqlite
public static class ServiceCollectionRegistrarSqlite
{
public static void Register(IIocManager iocManager)
{
var services = new ServiceCollection();
IdentityRegistrar.Register(services);
services.AddEntityFrameworkSqlite();
var serviceProvider = WindsorRegistrationHelper.CreateServiceProvider(iocManager.IocContainer, services);
var builder = new DbContextOptionsBuilder<DeviceManageSystemDbContext>();
var inMemorySqlite = new SqliteConnection("Data Source=:memory:");
builder.UseSqlite(inMemorySqlite);
iocManager.IocContainer.Register(
Component
.For<DbContextOptions<DeviceManageSystemDbContext>>()
.Instance(builder.Options)
.LifestyleSingleton()
);
inMemorySqlite.Open();
new DeviceManageSystemDbContext(builder.Options).Database.EnsureCreated();
}
}
添加DeviceManageSystemTestModuleSqlite
复制DeviceManageSystemTestModule,修改
[DependsOn(
typeof(DeviceManageSystemApplicationModule),
typeof(DeviceManageSystemEntityFrameworkModule),
typeof(AbpTestBaseModule)
)]
public class DeviceManageSystemTestModuleSqlite : AbpModule
{
public override void Initialize()
{
ServiceCollectionRegistrarSqlite.Register(IocManager);
}
}
修改DeviceManageSystemTestBase
public abstract class DeviceManageSystemTestBase : AbpIntegratedTestBase<DeviceManageSystemTestModuleSqlite>
{
}
将Abp的UnitTest中的InMemory改为SQLite in memory的更多相关文章
- unittest中更高效的执行测试用例一个类只需要打开一次浏览器
示例代码 baidu.py # _*_ coding:utf-8 _*_ import csv,unittest #导入csv模块 from time import sleep from seleni ...
- JAVA开发工具eclipse中@author怎么改
1:JAVA开发工具eclipse中@author怎么改,开发的时候为了注明版权信息. 用eclipse开发工具默认的是系统用户,那么怎么修改呢 示例如图所示 首先打开Eclipse--->然后 ...
- CC2530中串口波特率改为9600时单个数据包来不及接收的解决方案
在调试CC2530过程中发现波特率改为9600时,单个包仅有3个Byte时,接收DMA就会启动 因而数据包被强迫拆分成多个,显然只要将接收DMA启动延时做到足够大即可. 具体修改内容如下图所示: 经过 ...
- unittest中的方法调用时报错ValueError: no such test method in <class 'mytestcase.MyTestCase'>: runTest
调用unittest中的方法时报错: ValueError: no such test method in <class 'mytestcase.MyTestCase'>: runTest ...
- unittest中的TestLoader使用
一:unittest中的TestLoader使用说明 第一步:unittest增加TestSuit() suite=unittest.TestSuite() 第二步:unittest增加Testloa ...
- unittest 中的方法调用时报错 ValueError: no such test method in <class 'mytestcase.MyTestCase'>: runTest
1.调用unittest中的方法时报错: ValueError: no such test method in <class 'mytestcase.MyTestCase'>: runTe ...
- ABP VNext框架中Winform终端的开发和客户端授权信息的处理
在ABP VNext框架中,即使在它提供的所有案例中,都没有涉及到Winform程序的案例介绍,不过微服务解决方案中提供了一个控制台的程序供了解其IDS4的调用和处理,由于我开发过很多Winform项 ...
- 在ABP VNext框架中对HttpApi模块的控制器进行基类封装
在ABP VNext框架中,HttpApi项目是我们作为Restful格式的控制器对象的封装项目,但往往很多案例都是简单的继承基类控制器AbpControllerBase,而需要在每个控制器里面重写很 ...
- 在ABP VNext框架中处理和用户相关的多对多的关系
前面介绍了一些ABP VNext架构上的内容,随着内容的细化,我们会发现ABP VNext框架中的Entity Framework处理表之间的引用关系还是比较麻烦的,一不小心就容易出错了,本篇随笔介绍 ...
随机推荐
- Android res之shape
xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...
- uboot下如何读写rtc pcf2127的寄存器?
一. pcf2127简介 pcf2127是实时时钟计数器模块,支持两种接口,i2c和spi,笔者以i2c为例 二. pcf2127的读写操作时序 2.1 写操作 根据i2c的规范https://www ...
- C++中的各种容器实现原理
C++ 容器及选用总结 vector 拥有一段连续的内存空间 list 就是数据结构中的双向链表 deque 的动态数组首尾都开放 set 有序的容器,红黑树的平衡二叉检索树的数据结构 multise ...
- IEDA 实现自动生成序列化号(serialVersionUID)
完整操作流程:Setting->Editor->Inspections->Java->Serialization issues->Serializable class w ...
- ZeroC ICE java异步实现方式(ami/amd)
首先说说ami 和amd 的区别(以下为个人见解,仅供参考.如有疑问欢迎提出来) ami (异步方法调用): 仅仅基于ice 的同步方式扩展了异步的扩展方式,其他理念改动不大,使用起来好理解,但是服务 ...
- 五十六:flask文件上传之上传文件与访问上传的文件
实现上传文件 1.在form表单中,需指定enctype="multipart/form-data",且文件上传的input标签type="file"2.在后台 ...
- Android ADT安装与卸载
Android ADT安装 Eclipse 版本: Eclipse Java EE IDE for Web Developers. Version: Kepler Release Build id: ...
- ABAP Field+offset字符串截取
*删除字符串末尾的字符 DATA:str TYPE string VALUE 'abc,defg,', sub_str TYPE string, num TYPE i. WRITE:/ str. nu ...
- Python之文件操作工具
逐步完善中. #!/usr/bin/python3 # -*- coding: utf-8 -*- import os import codecs #支持多国语言的编码解码 import charde ...
- bootstrap文件上传C#实现
https://www.cnblogs.com/landeanfen/p/5007400.html