add(test):添加单元测试

This commit is contained in:
2025-12-07 15:44:51 +08:00
170 changed files with 14260 additions and 18 deletions
+8
View File
@@ -0,0 +1,8 @@
namespace IM_API.Models
{
public enum ChatType
{
PRIVATE = 0,
GROUP = 1
}
}
+10 -3
View File
@@ -49,10 +49,17 @@ public partial class ImContext : DbContext
public virtual DbSet<Role> Roles { get; set; }
public virtual DbSet<User> Users { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseMySql("server=frp-era.com;port=26582;database=IM;user=product;password=12345678", Microsoft.EntityFrameworkCore.ServerVersion.Parse("5.7.44-mysql"));
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseMySql(
"server=frp-era.com;port=26582;database=IM;user=product;password=12345678",
ServerVersion.Parse("5.7.44-mysql")
);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
+5
View File
@@ -7,6 +7,11 @@
get => (MessageMsgType)MsgType;
set => MsgType = (sbyte) value;
}
public ChatType ChatTypeEnum
{
get => (ChatType)ChatType;
set => ChatType = (sbyte)value;
}
public MessageState StateEnum
{
get => (MessageState)State;
+1 -1
View File
@@ -20,7 +20,7 @@ public partial class User
/// <summary>
/// 用户昵称
/// </summary>
public string NickName { get; set; } = null!;
public string? NickName { get; set; } = null!;
/// <summary>
/// 用户在线状态