Skip to content

Commit df533b3

Browse files
committed
test: 更新单元测试
1 parent 5c75c7a commit df533b3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

test/UnitTest/Components/TableTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,12 @@ public void ResetFilter_Null()
731731
[Fact]
732732
public async Task ShowColumnList_Ok()
733733
{
734+
// 设置客户端存储
735+
Context.JSInterop.Setup<List<ColumnVisibleItem>>("reloadColumnList", "test").SetResult(
736+
[
737+
new("Name", false),
738+
new("Address", true)
739+
]);
734740
var show = false;
735741
var localizer = Context.Services.GetRequiredService<IStringLocalizer<Foo>>();
736742
var cut = Context.RenderComponent<BootstrapBlazorRoot>(pb =>
@@ -764,6 +770,7 @@ public async Task ShowColumnList_Ok()
764770
builder.AddAttribute(2, "FieldExpression", Utility.GenerateValueExpression(foo, "Address", typeof(string)));
765771
builder.CloseComponent();
766772
});
773+
pb.Add(a => a.ClientTableName, "test");
767774
});
768775
});
769776
cut.Contains("Test_Column_List");

test/UnitTest/Utils/UtilityTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public void GetJsonStringByTypeName_UseKeyWhenValueIsNull()
389389
// improve code coverage
390390
var option = Context.Services.GetRequiredService<IOptions<JsonLocalizationOptions>>().Value;
391391
option.UseKeyWhenValueIsNull = true;
392-
var items = Utility.GetJsonStringByTypeName(option, this.GetType().Assembly, "UnitTest.Utils.UtilityTest", "en-US", true);
392+
var items = Utility.GetJsonStringByTypeName(option, GetType().Assembly, "UnitTest.Utils.UtilityTest", "en-US", true);
393393

394394
var test1 = items.FirstOrDefault(i => i.Name == "Test-Null");
395395
Assert.NotNull(test1);

0 commit comments

Comments
 (0)