修复运行单个单元测试时,获取OpenAuth.WebApi配置文件路径异常的问题。

This commit is contained in:
sesamefly 2021-05-13 10:48:53 +08:00 committed by Gitee
parent 35a13a4772
commit 21f25fc42d

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
@ -39,7 +39,7 @@ namespace OpenAuth.Repository.Test
//模拟配置文件
//读取OpenAuth.WebApi的配置文件用于单元测试
var path = AppContext.BaseDirectory;
int pos = path.IndexOf("OpenAuth.Repository");
int pos = path.LastIndexOf("OpenAuth.");
var basepath = Path.Combine(path.Substring(0,pos) ,"OpenAuth.WebApi");
IConfiguration config = new ConfigurationBuilder()
.SetBasePath(basepath)