单元测试:DictsTest测试用例先删除数据,再插入,再删除保证测试用例成功完成
This commit is contained in:
parent
4fd9fadc1b
commit
9341e63dcc
|
@ -26,10 +26,12 @@ namespace Bootstrap.Admin.Api
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void PostAndDelete_Ok()
|
public async void PostAndDelete_Ok()
|
||||||
{
|
{
|
||||||
|
var dict = new Dict();
|
||||||
|
dict.Delete(new Dict().RetrieveDicts().Where(d => d.Category == "UnitTest-Category").Select(d => d.Id));
|
||||||
|
|
||||||
var ret = await Client.PostAsJsonAsync<BootstrapDict, bool>("", new BootstrapDict() { Name = "UnitTest-Dict", Category = "UnitTest-Category", Code = "0", Define = 0 });
|
var ret = await Client.PostAsJsonAsync<BootstrapDict, bool>("", new BootstrapDict() { Name = "UnitTest-Dict", Category = "UnitTest-Category", Code = "0", Define = 0 });
|
||||||
Assert.True(ret);
|
Assert.True(ret);
|
||||||
|
|
||||||
var dict = new Dict();
|
|
||||||
var ids = dict.RetrieveDicts().Where(d => d.Name == "UnitTest-Dict").Select(d => d.Id);
|
var ids = dict.RetrieveDicts().Where(d => d.Name == "UnitTest-Dict").Select(d => d.Id);
|
||||||
Assert.True(await Client.DeleteAsJsonAsync<IEnumerable<string>, bool>("", ids));
|
Assert.True(await Client.DeleteAsJsonAsync<IEnumerable<string>, bool>("", ids));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue