test: 更改 SaveUISettings 单元测试
This commit is contained in:
parent
ac3eaa58b6
commit
c9bd585d57
|
@ -144,7 +144,7 @@ namespace Bootstrap.DataAccess
|
|||
["CookiePeriod"] = "Cookie保留时长",
|
||||
["IPCachePeriod"] = "IP请求缓存时长"
|
||||
};
|
||||
var ret = DictHelper.SaveSettings(items.Where(i => cache.Any(c => c.Key == i.Name)).Select(i => new BootstrapDict()
|
||||
var ret = SaveSettings(items.Where(i => cache.Any(c => c.Key == i.Name)).Select(i => new BootstrapDict()
|
||||
{
|
||||
Category = "网站设置",
|
||||
Name = cache[i.Name],
|
||||
|
|
|
@ -29,14 +29,15 @@ namespace Bootstrap.Admin.Api
|
|||
|
||||
Assert.True(DictHelper.Save(new BootstrapDict() { Category = "UnitTest-Settings", Name = "UnitTest", Code = "0", Define = 0 }));
|
||||
|
||||
// 获得原来值
|
||||
// 调用 Settings webapi
|
||||
var resp = await Client.PostAsJsonAsync<IEnumerable<BootstrapDict>, bool>("", new BootstrapDict[]{
|
||||
new BootstrapDict() { Category = "UnitTest-Settings", Name = "UnitTest", Code = "UnitTest" }
|
||||
});
|
||||
Assert.True(resp);
|
||||
|
||||
// 由于 SaveUISettings 函数保护功能,上一步保存成功,但是未更改 Code 值
|
||||
var code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "UnitTest-Settings").Code;
|
||||
Assert.Equal("UnitTest", code);
|
||||
Assert.Equal("0", code);
|
||||
|
||||
// Delete
|
||||
ids = DictHelper.RetrieveDicts().Where(d => d.Category == "UnitTest-Settings").Select(d => d.Id);
|
||||
|
|
Loading…
Reference in New Issue