From e9ef57d559e0805e07db849e6bddbe032ed4114e Mon Sep 17 00:00:00 2001 From: Argo-Surface Date: Wed, 16 Jan 2019 13:38:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0InterfaceController=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UnitTest/Bootstrap.Admin/Api/InterfaceTest.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 UnitTest/Bootstrap.Admin/Api/InterfaceTest.cs diff --git a/UnitTest/Bootstrap.Admin/Api/InterfaceTest.cs b/UnitTest/Bootstrap.Admin/Api/InterfaceTest.cs new file mode 100644 index 00000000..ba57d44a --- /dev/null +++ b/UnitTest/Bootstrap.Admin/Api/InterfaceTest.cs @@ -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>("RetrieveDicts", ""); + Assert.NotEmpty(ret); + } + + [Fact] + public async void RetrieveRolesByUrl_Ok() + { + var ret = await Client.PostAsJsonAsync>("RetrieveRolesByUrl", "~/Admin/Index"); + Assert.NotEmpty(ret); + } + + [Fact] + public async void RetrieveRolesByUserName_Ok() + { + var ret = await Client.PostAsJsonAsync>("RetrieveRolesByUserName", "Admin"); + Assert.NotEmpty(ret); + } + + [Fact] + public async void RetrieveUserByUserName_Ok() + { + var ret = await Client.PostAsJsonAsync("RetrieveUserByUserName", "Admin"); + Assert.Equal("Admin", ret.UserName); + } + + [Fact] + public async void RetrieveAppMenus_Ok() + { + var ret = await Client.PostAsJsonAsync>("RetrieveAppMenus", new AppMenuOption() { AppId = "0", UserName = "Admin", Url = "~/Admin/Index" }); + Assert.NotEmpty(ret); + } + } +} \ No newline at end of file