From 12c53eeead855dfacdcbae469612f7ca0a382e3f Mon Sep 17 00:00:00 2001 From: Argo-Surface Date: Mon, 14 Jan 2019 21:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=B7=A5=E7=A8=8B=EF=BC=9A?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Bootstrap.Admin.csproj | 2 +- .../Bootstrap.Client.DataAccess.csproj | 6 +++--- Bootstrap.Client/Bootstrap.Client.csproj | 6 +++--- Bootstrap.DataAccess/Bootstrap.DataAccess.csproj | 4 ++-- .../Bootstrap.DataAccess/BootstrapAdminStartup.cs | 2 +- UnitTest/Bootstrap.DataAccess/RolesTest.cs | 11 ++++++++--- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index fe8c7d11..b128ffc2 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -14,7 +14,7 @@ - + diff --git a/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj b/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj index 4d782cc0..4c490177 100644 --- a/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj +++ b/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/Bootstrap.Client/Bootstrap.Client.csproj b/Bootstrap.Client/Bootstrap.Client.csproj index c910d387..fbe1d9a8 100644 --- a/Bootstrap.Client/Bootstrap.Client.csproj +++ b/Bootstrap.Client/Bootstrap.Client.csproj @@ -10,9 +10,9 @@ - - - + + + diff --git a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj index cafabf1f..f9fe432d 100644 --- a/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj +++ b/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj @@ -13,9 +13,9 @@ - + - + diff --git a/UnitTest/Bootstrap.DataAccess/BootstrapAdminStartup.cs b/UnitTest/Bootstrap.DataAccess/BootstrapAdminStartup.cs index a378e5ed..ffb853d2 100644 --- a/UnitTest/Bootstrap.DataAccess/BootstrapAdminStartup.cs +++ b/UnitTest/Bootstrap.DataAccess/BootstrapAdminStartup.cs @@ -1,4 +1,4 @@ -#define SQLite +//#define SQLite //#define MySQL using Microsoft.Extensions.Configuration; diff --git a/UnitTest/Bootstrap.DataAccess/RolesTest.cs b/UnitTest/Bootstrap.DataAccess/RolesTest.cs index 08494178..21559ee4 100644 --- a/UnitTest/Bootstrap.DataAccess/RolesTest.cs +++ b/UnitTest/Bootstrap.DataAccess/RolesTest.cs @@ -1,4 +1,5 @@ -using Xunit; +using System.Linq; +using Xunit; namespace Bootstrap.DataAccess { @@ -45,9 +46,9 @@ namespace Bootstrap.DataAccess public void RetrieveRolesByMenuId_Ok() { var menu = new Menu(); - menu.SaveMenusByRoleId("1", new string[] { "1" }); - var role = new Role(); + var id = role.Retrieves().FirstOrDefault(r => r.RoleName == "Administrators").Id; + menu.SaveMenusByRoleId(id, new string[] { "1" }); var rs = role.RetrievesByMenuId("1"); Assert.Contains(rs, r => r.Checked == "checked"); } @@ -63,6 +64,8 @@ namespace Bootstrap.DataAccess public void RetrieveRolesByGroupId_Ok() { var role = new Role(); + var id = role.Retrieves().FirstOrDefault(r => r.RoleName == "Administrators").Id; + new Group().SaveByRoleId(id, new string[] { "1" }); Assert.Contains(role.RetrievesByGroupId("1"), r => r.Checked == "checked"); } @@ -70,6 +73,8 @@ namespace Bootstrap.DataAccess public void RetrieveRolesByUserName_Ok() { var role = new Role(); + var id = role.Retrieves().FirstOrDefault(r => r.RoleName == "Administrators").Id; + new User().SaveByRoleId(id, new string[] { "1" }); Assert.NotEmpty(role.RetrieveRolesByUserName("Admin")); }