mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-02 12:09:59 +08:00
!2770 test(#I56WS9): update unit test for Speech
* refactor: 更细参数类型 * Merge branch 'main' into doc-editor * Merge branch 'main' into doc-editor * test: 增加单元测试 * test: 修复语音组件单元测试 * test: 增加 Editor 单元测试项目 * feat: 增加版本号信息 * doc: 更新资源文件 * doc: 增加包文档 * refactor: 移除 sealed 修饰符 * chore: 更新配置文件
This commit is contained in:
parent
06c9761565
commit
dafc3f672e
@ -14,19 +14,22 @@ public class RecognizerTest : SpeechTestBase
|
||||
{
|
||||
var result = "";
|
||||
var recognizerService = Context.Services.GetRequiredService<RecognizerService>();
|
||||
await recognizerService.InvokeAsync(new RecognizerOption()
|
||||
var option = new RecognizerOption()
|
||||
{
|
||||
MethodName = "Test",
|
||||
TargetLanguage = "zh-CN",
|
||||
SpeechRecognitionLanguage = "zh-CN",
|
||||
Callback = new Func<string, Task>(v =>
|
||||
AutoRecoginzerElapsedMilliseconds = 5000,
|
||||
Callback = new Func<RecognizerStatus, string?, Task>((status, v) =>
|
||||
{
|
||||
result = v;
|
||||
return Task.CompletedTask;
|
||||
})
|
||||
});
|
||||
};
|
||||
await recognizerService.InvokeAsync(option);
|
||||
|
||||
Assert.Equal("MockSpeechProvider", result);
|
||||
Assert.Equal(5000, option.AutoRecoginzerElapsedMilliseconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -75,7 +75,7 @@ public class SpeechTestHost : IDisposable
|
||||
var recognitionLanguage = option.SpeechRecognitionLanguage;
|
||||
if (option.Callback != null)
|
||||
{
|
||||
await option.Callback("MockSpeechProvider");
|
||||
await option.Callback(RecognizerStatus.Start, "MockSpeechProvider");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user