Skip to content

Commit 0d0ae64

Browse files
committed
test: 更新单元测试
1 parent 3a82f09 commit 0d0ae64

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/UnitTest/Components/TabTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Bunit.TestDoubles;
88
using Microsoft.AspNetCore.Components.Rendering;
99
using System.Reflection;
10-
using System.Threading.Tasks;
1110
using UnitTest.Misc;
1211

1312
namespace UnitTest.Components;
@@ -1100,6 +1099,11 @@ public async Task ShowToolbar_Ok()
11001099
await cut.InvokeAsync(() => button.Click());
11011100
Assert.True(clicked);
11021101

1102+
clicked = false;
1103+
var item = cut.FindComponent<TabItem>();
1104+
await cut.InvokeAsync(() => tab.Instance.Refresh(item.Instance));
1105+
Assert.True(clicked);
1106+
11031107
tab.SetParametersAndRender(pb =>
11041108
{
11051109
pb.Add(a => a.ShowRefreshToolbarButton, false);
@@ -1111,13 +1115,6 @@ public async Task ShowToolbar_Ok()
11111115
pb.Add(a => a.ShowFullscreenToolbarButton, false);
11121116
});
11131117
cut.DoesNotContain("tabs-nav-toolbar-fs");
1114-
1115-
// 利用反射提高代码覆盖率
1116-
var type = Type.GetType("BootstrapBlazor.Components.TabItemExtensions, BootstrapBlazor");
1117-
Assert.NotNull(type);
1118-
var mi = type.GetMethod("Refresh", BindingFlags.Static | BindingFlags.Public);
1119-
Assert.NotNull(mi);
1120-
mi.Invoke(null, [null, null]);
11211118
}
11221119

11231120
class DisableTabItemButton : ComponentBase

0 commit comments

Comments
 (0)