!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:
Argo 2022-05-11 07:08:12 +00:00
parent 06c9761565
commit dafc3f672e
2 changed files with 7 additions and 4 deletions

View File

@ -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]

View File

@ -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");
}
}
}