单元测试:增加InterfaceController单元测试
This commit is contained in:
parent
e6c5639150
commit
e9ef57d559
|
@ -0,0 +1,48 @@
|
|||
using Bootstrap.Security;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.Admin.Api
|
||||
{
|
||||
public class InterfaceTest : ApiTest
|
||||
{
|
||||
public InterfaceTest(BAWebHost factory) : base(factory, "Interface", true)
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RetrieveDicts_Ok()
|
||||
{
|
||||
var ret = await Client.PostAsJsonAsync<string, IEnumerable<BootstrapDict>>("RetrieveDicts", "");
|
||||
Assert.NotEmpty(ret);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RetrieveRolesByUrl_Ok()
|
||||
{
|
||||
var ret = await Client.PostAsJsonAsync<string, IEnumerable<string>>("RetrieveRolesByUrl", "~/Admin/Index");
|
||||
Assert.NotEmpty(ret);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RetrieveRolesByUserName_Ok()
|
||||
{
|
||||
var ret = await Client.PostAsJsonAsync<string, IEnumerable<string>>("RetrieveRolesByUserName", "Admin");
|
||||
Assert.NotEmpty(ret);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RetrieveUserByUserName_Ok()
|
||||
{
|
||||
var ret = await Client.PostAsJsonAsync<string, BootstrapUser>("RetrieveUserByUserName", "Admin");
|
||||
Assert.Equal("Admin", ret.UserName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void RetrieveAppMenus_Ok()
|
||||
{
|
||||
var ret = await Client.PostAsJsonAsync<AppMenuOption, IEnumerable<BootstrapMenu>>("RetrieveAppMenus", new AppMenuOption() { AppId = "0", UserName = "Admin", Url = "~/Admin/Index" });
|
||||
Assert.NotEmpty(ret);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue