Skip to content

Commit b837080

Browse files
committed
test: 增加单元测试
1 parent 4eebaad commit b837080

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/UnitTest/Services/VideoDeviceTest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public async Task GetDevices_Ok()
2727
public async Task Open_Ok()
2828
{
2929
Context.JSInterop.Setup<string?>("getPreviewUrl").SetResult("blob:https://test-preview");
30+
Context.JSInterop.Setup<Stream?>("getPreviewData").SetResult(new MemoryStream([0x01, 0x02]));
3031
Context.JSInterop.Setup<bool>("open", _ => true).SetResult(true);
3132
Context.JSInterop.Setup<bool>("close", _ => true).SetResult(true);
3233
Context.JSInterop.Setup<bool>("apply", _ => true).SetResult(true);
@@ -58,5 +59,9 @@ public async Task Open_Ok()
5859
await service.Capture();
5960
var url = await service.GetPreviewUrl();
6061
Assert.Equal("blob:https://test-preview", url);
62+
63+
var data = await service.GetPreviewData();
64+
Assert.NotNull(data);
65+
Assert.Equal(2, data.Length);
6166
}
6267
}

0 commit comments

Comments
 (0)