将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处理表之间的引用关系还是比较麻烦的,一不小心就容易出错了,本篇随笔介绍 ...
随机推荐
- Nginx一个server配置多个location
在配置文件中增加多个location,每个location对应一个项目 比如使用8066端口,location / 访问官网: location /demo访问培训管理系统配置多个站点我选择了配置多个 ...
- IntelliJ IDEA工具增加test测试方法,报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing错误
是因为我在IntelliJ IDEA中,通过plugins增加 插件的时候,在 增加的测试类是junit4.12,改版本的jar包不再包含hamcrest-library.jar .我是通过将自己的项 ...
- under the hood
under the hood adjective a metaphorical area that contains the underlying implementation of somethin ...
- python pymysql 连接 mysql数据库进行操作
1.数据库的连接操作 import pymysql conn = pymysql.connect(host=', db='oldboydb') # host表示ip地址,user表示用户名,passw ...
- JxBrowser开启调试模式,JxBrowser debug
原文: 一.问题描述 像一般的浏览器都带了调试功能,按F12就能打开,在JxBrowser中如何开启调试模式了. 二.解决方法 以下代码就能开启调试模式: import com.teamdev.jxb ...
- C++ string与int的互相转换
原文地址 C++本身就提供了字符串与整型数之间的互换,那就是利用stringstream.下面是使用方法: 核心: 利用C++中的stringstream流. 由于使用过程比较简单就不再赘述,直接给出 ...
- JAVA向C传递数据
传递数组 数组是个对象,传递对象就是传递地址,修改地址上的值,数组的内容就会改变 //获取数组首地址 int* p = (*env)->GetIntArrayElements(env, arra ...
- idea 中提示:Warning:java: 源值1.5已过时, 将在未来所有发行版中删除
maven的配置文件settings.xml中添加: <profile> <id>jdk-1.8</id> <activation> <activ ...
- python常见报错
1.Pycharm No module named requests 的解决方法 pip install requests 然后重启pycharm
- pyQt点击事件和数据传输
首先是PushButton点击事件,点击按钮之后发送textEdit框里输入的文字到后台. def retranslateUi(self, MainWindow): _translate = QtCo ...