mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-08-23 13:06:48 +08:00
修复单元测试异常
This commit is contained in:
parent
5f8ef13037
commit
1228c6e875
@ -27,20 +27,24 @@ namespace OpenAuth.App
|
||||
}
|
||||
CaculateCascade(org);
|
||||
|
||||
Repository.Add(org);
|
||||
|
||||
//如果当前账号不是SYSTEM,则直接分配
|
||||
var loginUser = _auth.GetCurrentUser();
|
||||
if (loginUser.User.Account != Define.SYSTEM_USERNAME)
|
||||
UnitWork.ExecuteWithTransaction(() =>
|
||||
{
|
||||
_revelanceApp.Assign(new AssignReq
|
||||
UnitWork.Add(org);
|
||||
UnitWork.Save();
|
||||
|
||||
//如果当前账号不是SYSTEM,则直接分配
|
||||
var loginUser = _auth.GetCurrentUser();
|
||||
if (loginUser.User.Account != Define.SYSTEM_USERNAME)
|
||||
{
|
||||
type=Define.USERORG,
|
||||
firstId = loginContext.User.Id,
|
||||
secIds = new[]{org.Id}
|
||||
});
|
||||
}
|
||||
|
||||
_revelanceApp.Assign(new AssignReq
|
||||
{
|
||||
type = Define.USERORG,
|
||||
firstId = loginContext.User.Id,
|
||||
secIds = new[] { org.Id }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return org.Id;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace OpenAuth.App.Test
|
||||
var serviceCollection = GetService();
|
||||
serviceCollection.AddMemoryCache();
|
||||
serviceCollection.AddOptions();
|
||||
serviceCollection.AddLogging();
|
||||
|
||||
var optionMock = new Mock<IOptions<AppSetting>>();
|
||||
optionMock.Setup(x => x.Value).Returns(new AppSetting { DbType = Define.DBTYPE_MYSQL});
|
||||
|
@ -22,6 +22,7 @@ namespace OpenAuth.Repository.Test
|
||||
var serviceCollection = GetService();
|
||||
serviceCollection.AddMemoryCache();
|
||||
serviceCollection.AddOptions();
|
||||
serviceCollection.AddLogging();
|
||||
serviceCollection.AddScoped(typeof(IRepository<,>), typeof(BaseRepository<,>));
|
||||
serviceCollection.AddScoped(typeof(IUnitWork<>), typeof(UnitWork<>));
|
||||
|
||||
|
@ -15,6 +15,9 @@ namespace OpenAuth.WebApi.Controllers
|
||||
{
|
||||
private readonly OrgManagerApp _app;
|
||||
|
||||
/// <summary>
|
||||
/// 获取机构详情
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public Response<Org> Get(string id)
|
||||
{
|
||||
@ -32,7 +35,12 @@ namespace OpenAuth.WebApi.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
//添加或修改
|
||||
/// <summary>
|
||||
/// 新增机构
|
||||
/// <para>如果ID为空,会自动创建ID;会自动为当前登录用户分配添加的机构</para>
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Response<Org> Add(Org obj)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user