Skip to content

Commit 6f5cc41

Browse files
committed
test: 更新单元测试
1 parent 3e56a5b commit 6f5cc41

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/UnitTest/Services/MaskServiceTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public async Task Show_Component()
9292
});
9393
var button = cut.Find("button");
9494
await cut.InvokeAsync(() => button.Click());
95+
96+
var com = cut.FindComponent<MockComponent>();
97+
var result = await cut.InvokeAsync(com.Instance.Test);
98+
Assert.True(result);
9599
}
96100

97101
[Fact]
@@ -114,6 +118,17 @@ public async Task Show_Type()
114118

115119
class MockComponent : ComponentBase
116120
{
121+
[CascadingParameter]
122+
private Func<Task>? OnCloseAsync { get; set; }
123+
124+
public async Task<bool> Test()
125+
{
126+
if (OnCloseAsync != null)
127+
{
128+
await OnCloseAsync();
129+
}
117130

131+
return OnCloseAsync != null;
132+
}
118133
}
119134
}

0 commit comments

Comments
 (0)