feat: 完成云同步、语音控制与多平台扩展基础架构搭建
本次提交完成了项目核心基础架构升级: 1. 新增动态API中间件与权限控制系统,支持匿名/鉴权接口分离 2. 搭建云同步服务体系,包含认证、任务同步、安全策略等核心模块 3. 实现语音控制全链路,从STT/意图解析到命令执行 4. 新增任务类型、附件实体与相关仓储接口 5. 重构前端配置与代理规则,统一后端端口为5057 6. 新增多平台测试项目与CI脚本优化 7. 完善项目文档与代码注释规范 移除了旧版迁移文件与冗余代理配置,调整项目结构适配跨平台部署需求。
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using Hua.Todo.Application.Services.Meeting;
|
||||
using Hua.Todo.Application.Services.Meeting.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace Hua.Todo.Host.Tests.Meeting;
|
||||
|
||||
/// <summary>
|
||||
/// 工单 03-02 音频录制与转写测试。
|
||||
/// </summary>
|
||||
public class MeetingTranscriptionTests
|
||||
{
|
||||
[Fact]
|
||||
public void TranscribeRequest_CanBeCreated()
|
||||
{
|
||||
var taskId = Guid.NewGuid();
|
||||
var request = new TranscribeRequest
|
||||
{
|
||||
TaskId = taskId,
|
||||
AudioBase64 = "dGVzdA==",
|
||||
Format = "webm",
|
||||
AudioDuration = 90.0
|
||||
};
|
||||
|
||||
Assert.Equal(taskId, request.TaskId);
|
||||
Assert.Equal("dGVzdA==", request.AudioBase64);
|
||||
Assert.Equal("webm", request.Format);
|
||||
Assert.Equal(90.0, request.AudioDuration);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TranscribeResponse_CanBeCreated()
|
||||
{
|
||||
var taskId = Guid.NewGuid();
|
||||
var response = new TranscribeResponse
|
||||
{
|
||||
TaskId = taskId,
|
||||
Transcript = "这是转写后的文字内容",
|
||||
AudioDuration = 90.0
|
||||
};
|
||||
|
||||
Assert.Equal(taskId, response.TaskId);
|
||||
Assert.Equal("这是转写后的文字内容", response.Transcript);
|
||||
Assert.Equal(90.0, response.AudioDuration);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TranscribeResponse_DefaultValues()
|
||||
{
|
||||
var response = new TranscribeResponse();
|
||||
|
||||
Assert.Equal(Guid.Empty, response.TaskId);
|
||||
Assert.Equal(string.Empty, response.Transcript);
|
||||
Assert.Equal(0.0, response.AudioDuration);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TranscribeRequest_DefaultValues()
|
||||
{
|
||||
var request = new TranscribeRequest();
|
||||
|
||||
Assert.Equal(Guid.Empty, request.TaskId);
|
||||
Assert.Equal(string.Empty, request.AudioBase64);
|
||||
Assert.Equal(string.Empty, request.Format);
|
||||
Assert.Equal(0.0, request.AudioDuration);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ISttService_InterfaceExists()
|
||||
{
|
||||
var type = typeof(ISttService);
|
||||
Assert.True(type.IsInterface);
|
||||
Assert.Contains("Hua.Todo.Application.Services.Meeting", type.Namespace);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SttService_ImplementsISttService()
|
||||
{
|
||||
var type = typeof(SttService);
|
||||
Assert.True(typeof(ISttService).IsAssignableFrom(type));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ISttService_HasTranscribeAsyncMethod()
|
||||
{
|
||||
var method = typeof(ISttService).GetMethod("TranscribeAsync");
|
||||
Assert.NotNull(method);
|
||||
Assert.Equal(typeof(Task<string>), method.ReturnType);
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
Assert.Equal(3, parameters.Length);
|
||||
Assert.Equal(typeof(Stream), parameters[0].ParameterType);
|
||||
Assert.Equal(typeof(string), parameters[1].ParameterType);
|
||||
Assert.Equal(typeof(CancellationToken), parameters[2].ParameterType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IMeetingService_HasTranscribeAudioAsyncMethod()
|
||||
{
|
||||
var method = typeof(IMeetingService).GetMethod("TranscribeAudioAsync");
|
||||
Assert.NotNull(method);
|
||||
Assert.Equal(typeof(Task<TranscribeResponse>), method.ReturnType);
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
Assert.Single(parameters);
|
||||
Assert.Equal(typeof(TranscribeRequest), parameters[0].ParameterType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user