test: 移除 Settings Post 单元测试
This commit is contained in:
parent
55d5e7f4fe
commit
4de4630dbc
|
@ -33,8 +33,8 @@ namespace Bootstrap.Admin.Api
|
||||||
var data = new QueryAppOption()
|
var data = new QueryAppOption()
|
||||||
{
|
{
|
||||||
AppId = "new",
|
AppId = "new",
|
||||||
AppName = "UnitTest",
|
AppName = "UnitTest_Put",
|
||||||
AppCode = "UnitTest",
|
AppCode = "UnitTest_Put",
|
||||||
AppUrl = "http://localhost",
|
AppUrl = "http://localhost",
|
||||||
AppTitle = "网站标题",
|
AppTitle = "网站标题",
|
||||||
AppFooter = "网站页脚"
|
AppFooter = "网站页脚"
|
||||||
|
@ -44,15 +44,24 @@ namespace Bootstrap.Admin.Api
|
||||||
Assert.True(resp);
|
Assert.True(resp);
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
var op = await Client.GetAsJsonAsync<QueryAppOption>("UnitTest");
|
var op = await Client.GetAsJsonAsync<QueryAppOption>(data.AppCode);
|
||||||
Assert.Equal(data.AppTitle, op.AppTitle);
|
Assert.Equal(data.AppTitle, op.AppTitle);
|
||||||
|
|
||||||
|
// update
|
||||||
|
data.AppId = "edit";
|
||||||
|
data.AppUrl = "http://UnitTest";
|
||||||
|
resp = await Client.PutAsJsonAsync<QueryAppOption, bool>("", data);
|
||||||
|
Assert.True(resp);
|
||||||
|
|
||||||
|
op = await Client.GetAsJsonAsync<QueryAppOption>(data.AppCode);
|
||||||
|
Assert.Equal(data.AppUrl, op.AppUrl);
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
resp = await Client.DeleteAsJsonAsync<BootstrapDict, bool>("AppPath", new BootstrapDict()
|
resp = await Client.DeleteAsJsonAsync<BootstrapDict, bool>("AppPath", new BootstrapDict()
|
||||||
{
|
{
|
||||||
Category = "UnitTest",
|
Category = data.AppName,
|
||||||
Name = "UnitTest",
|
Name = data.AppName,
|
||||||
Code = "UnitTest"
|
Code = data.AppCode
|
||||||
});
|
});
|
||||||
Assert.True(resp);
|
Assert.True(resp);
|
||||||
}
|
}
|
||||||
|
@ -91,31 +100,6 @@ namespace Bootstrap.Admin.Api
|
||||||
|
|
||||||
resp = await Client.PostAsJsonAsync<BootstrapDict, bool>("Demo", new BootstrapDict() { Name = "123789", Code = "0" });
|
resp = await Client.PostAsJsonAsync<BootstrapDict, bool>("Demo", new BootstrapDict() { Name = "123789", Code = "0" });
|
||||||
Assert.True(resp);
|
Assert.True(resp);
|
||||||
|
|
||||||
// AppPath
|
|
||||||
var dict = new BootstrapDict() { Category = "UnitTest", Name = "UnitTest", Code = "http://localhost/AppPath/" };
|
|
||||||
resp = await Client.PostAsJsonAsync<BootstrapDict, bool>("AppPath", dict);
|
|
||||||
Assert.True(resp);
|
|
||||||
|
|
||||||
Assert.Equal(dict.Code.TrimEnd('/'), DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "应用首页" && d.Name == dict.Name)?.Code ?? "");
|
|
||||||
|
|
||||||
// update by set dict.Define = 0
|
|
||||||
dict.Define = 0;
|
|
||||||
dict.Code = "http://127.0.0.1/UnitTest";
|
|
||||||
resp = await Client.PostAsJsonAsync<BootstrapDict, bool>("AppPath", dict);
|
|
||||||
Assert.True(resp);
|
|
||||||
|
|
||||||
Assert.Equal(dict.Code.TrimEnd('/'), DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "应用首页" && d.Name == dict.Name)?.Code ?? "");
|
|
||||||
|
|
||||||
// del
|
|
||||||
dict.Name = "UnitTest";
|
|
||||||
dict.Code = "UnitTest";
|
|
||||||
resp = await Client.DeleteAsJsonAsync<BootstrapDict, bool>("AppPath", dict);
|
|
||||||
Assert.True(resp);
|
|
||||||
|
|
||||||
// Else
|
|
||||||
resp = await Client.PostAsJsonAsync<BootstrapDict, bool>("UnitTest", dict);
|
|
||||||
Assert.False(resp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class CacheCorsItem : ICacheCorsItem
|
internal class CacheCorsItem : ICacheCorsItem
|
||||||
|
|
Loading…
Reference in New Issue