add(test):添加单元测试

This commit is contained in:
2025-12-07 15:44:51 +08:00
170 changed files with 14260 additions and 18 deletions
+13 -5
View File
@@ -1,4 +1,6 @@
using IM_API.Interface.Services;
using IM_API.Dtos;
using IM_API.Interface.Services;
using IM_API.Tools;
using Microsoft.AspNetCore.SignalR;
using System.Security.Claims;
@@ -12,15 +14,21 @@ namespace IM_API.Hubs
_JWTService = jWTService;
}
public override Task OnConnectedAsync()
public async override Task OnConnectedAsync()
{
var userIdStr = Context.User.FindFirstValue(ClaimTypes.NameIdentifier);
if(userIdStr is null)
{
await Clients.Caller.SendAsync("ReceiveMessage",new BaseResponse<object?>(CodeDefine.AUTH_FAILED));
Context.Abort();
return;
}
int userId = int.Parse(userIdStr);
Console.WriteLine(userId);
return base.OnConnectedAsync();
await base.OnConnectedAsync();
}
public async Task SendMessage(string user,string message)
public async Task SendMessage(MessageBaseDto dto)
{
await Clients.Caller.SendAsync("ReceiveMessage", "qwfqwfqw","test");
}
}