test: 修复 Dicts 单元测试失败
This commit is contained in:
parent
72c5cd9414
commit
0eac1de73d
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue