Skip to content

Commit ee6f855

Browse files
committed
test: 更新单元测试
1 parent 0e82ced commit ee6f855

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/UnitTest/Services/VideoDeviceTest.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6+
using Microsoft.JSInterop;
7+
using UnitTest.Mock;
8+
69
namespace UnitTest.Services;
710

811
public class VideoDeviceTest : BootstrapBlazorTestBase
@@ -27,7 +30,7 @@ public async Task GetDevices_Ok()
2730
public async Task Open_Ok()
2831
{
2932
Context.JSInterop.Setup<string?>("getPreviewUrl").SetResult("blob:https://test-preview");
30-
Context.JSInterop.Setup<Stream?>("getPreviewData").SetResult(new MemoryStream([0x01, 0x02]));
33+
Context.JSInterop.Setup<IJSStreamReference?>("getPreviewData").SetResult(new MockJSStreamReference());
3134
Context.JSInterop.Setup<bool>("open", _ => true).SetResult(true);
3235
Context.JSInterop.Setup<bool>("close", _ => true).SetResult(true);
3336
Context.JSInterop.Setup<bool>("apply", _ => true).SetResult(true);
@@ -62,6 +65,6 @@ public async Task Open_Ok()
6265

6366
var data = await service.GetPreviewData();
6467
Assert.NotNull(data);
65-
Assert.Equal(2, data.Length);
68+
Assert.Equal(4, data.Length);
6669
}
6770
}

0 commit comments

Comments
 (0)