test: 修复 Dicts 单元测试失败

This commit is contained in:
Argo Window10 2019-11-26 12:00:27 +08:00
parent 72c5cd9414
commit 0eac1de73d
2 changed files with 19 additions and 18 deletions

View File

@ -85,24 +85,6 @@ namespace Bootstrap.DataAccess.SqlServer
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()
{

View File

@ -141,5 +141,24 @@ namespace Bootstrap.DataAccess
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"));
}
}
}