2019-01-21 17:33:20 +08:00
|
|
|
|
using Bootstrap.Security;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
2019-05-15 00:22:13 +08:00
|
|
|
|
namespace Bootstrap.Admin.Api.SqlServer
|
2019-01-21 17:33:20 +08:00
|
|
|
|
{
|
|
|
|
|
public class InterfaceTest : ControllerTest
|
|
|
|
|
{
|
|
|
|
|
public InterfaceTest(BAWebHost factory) : base(factory, "api/Interface") { }
|
|
|
|
|
|
|
|
|
|
[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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|