Skip to content

Commit

Permalink
test: 修复 Dicts 单元测试失败
Browse files Browse the repository at this point in the history
  • Loading branch information
ArgoZhang committed Nov 26, 2019
1 parent 72c5cd9 commit 0eac1de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 0 additions & 18 deletions test/UnitTest/Bootstrap.DataAccess/SQLServer/DictsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,6 @@ public void RetrieveIconFolderPath_Ok()
Assert.Equal("~/images/uploader/", DictHelper.RetrieveIconFolderPath());
}

[Fact]
public void RetrieveHomeUrl_Ok()
{
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("BA"));
var url = DictHelper.RetrieveHomeUrl("Demo");
Assert.Equal("http://localhost:49185/", url);

// INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 2, 'http://localhost:49185/', 0);
var dict = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "应用首页" && d.Name == "Demo");
url = dict.Code;
dict.Code = "BA";
Assert.True(DictHelper.Save(dict));
Assert.Equal("BA", DictHelper.RetrieveHomeUrl("Demo"));

dict.Code = url;
Assert.True(DictHelper.Save(dict));
}

[Fact]
public void RetrieveApps_Ok()
{
Expand Down
19 changes: 19 additions & 0 deletions test/UnitTest/Bootstrap.DataAccess/SystemModeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,24 @@ public void SaveByRoleID_Ok()
Assert.True(RoleHelper.SaveByUserId(uId, new string[0]));
Assert.Contains(RoleHelper.RetrievesByUserName("Admin"), r => r.Equals("Administrators"));
}

[Fact]
public void RetrieveHomeUrl_Ok()
{
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("BA"));
var url = DictHelper.RetrieveHomeUrl("Demo");
Assert.Equal("http://localhost:49185/", url);

// INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 2, 'http://localhost:49185/', 0);
var dict = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "应用首页" && d.Name == "Demo");
url = dict.Code;
dict.Code = "BA";
Assert.True(DictHelper.Save(dict));
Assert.Equal("BA", DictHelper.RetrieveHomeUrl("Demo"));

dict.Code = url;
Assert.True(DictHelper.Save(dict));
Assert.Equal(url, DictHelper.RetrieveHomeUrl("Demo"));
}
}
}

0 comments on commit 0eac1de

Please sign in to comment.