mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 10:24:44 +08:00
增加支持Autofac的http单元测试
fix issue #I50DRR
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
@@ -27,7 +27,11 @@ namespace OpenAuth.App.Test
|
||||
serviceCollection.AddOptions();
|
||||
//读取OpenAuth.WebApi的配置文件用于单元测试
|
||||
var path = AppContext.BaseDirectory;
|
||||
int pos = path.LastIndexOf("OpenAuth.");
|
||||
int pos = path.IndexOf("OpenAuth.App");
|
||||
if (pos == -1) //如果测试入口是OpenAuth.WebApi
|
||||
{
|
||||
pos = path.IndexOf("OpenAuth.WebApi");
|
||||
}
|
||||
var basepath = Path.Combine(path.Substring(0,pos) ,"OpenAuth.WebApi");
|
||||
IConfiguration config = new ConfigurationBuilder()
|
||||
.SetBasePath(basepath)
|
||||
|
||||
Reference in New Issue
Block a user