将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处理表之间的引用关系还是比较麻烦的,一不小心就容易出错了,本篇随笔介绍 ...
随机推荐
- JVM 监控工具——jstatd
1. 简介 jstatd是一个rmi的server应用,用于监控jvm的创建和结束,并且提供接口让监控工具(如visualvm)可以远程连接到本机的jvms . 注意是jvms,就是说运行jstatd ...
- SpringBoot Thymeleaf 配置多个Template Locations
@Configuration public class ThymeleafConfigration { @Bean public SpringResourceTemplateResolver firs ...
- 环信-(php)服务器端REST API
<?php namespace Home\Controller; use Think\Controller; /** * 环信-服务器端REST API * @author limx <l ...
- isEmpty和isBlank区别
isEmpty 判断某字符串是否为空,为空的标准是 str==null或 str.length()==0 StringUtils.isEmpty(null) = true StringUtils.is ...
- golang mysql 如何设置最大连接数和最大空闲连接数
本文介绍golang 中连接MySQL时,如何设置最大连接数和最大空闲连接数. 关于最大连接数和最大空闲连接数,是定义在golang标准库中database/sql的. 文中例子连接MySQL用的SQ ...
- electron关于页面跳转 的问题
刚开始看到页面跳转,大家一般会想到用 window.location.href = './index.html'; 这样的代码.结果是可以跳转,但 DOM事件 基本都会失效.到最后还是使用的 elec ...
- Mac下WebStorm直接运行ReactNative项目
1.首先点击WebStorm右上方的下拉箭头弹出的Edit Configurations…. 2.然后会进入一个配置页面.点击左上方的+.在弹出的列表中选中npm. 3.在右边的配置框中,先选择Com ...
- 简易的美图秀秀利用别人的so库
在实际开发中,有时候时间短,任务量大,可以查看类似的apk,将行apk反编译,通过看源码分析,用里面的JNI代码! 本案例中用了美图秀秀的JNI.java和jni.so链接库 项目中调用别人写的c代码 ...
- 搭建与破解wiki (confluence)
搭建环境: 操作系统:contos7 数据库:5.5.60-MariaDB java版本: jdk-11.0.2 confluence版本:confluence6.7.1 一. 准备工作 下载conf ...
- 使用sql developer 导出Oracle数据库中的表结构
MS SQLServer的客户端工具做的的确比较好,直接右键,导出数据库就OK了,而且MS的客户端导出的是xxx.dbf文件,直接附加到别的数据库上就OK了 Oracle的sql developer就 ...