Add unit test

This commit is contained in:
sunkaixuan
2023-09-28 14:14:16 +08:00
parent aa86c8439c
commit 746a24b88e
3 changed files with 121 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugarTest
{
public interface IDeleted
{
/// <summary>
/// 默认假删除
/// </summary>
//[FakeDelete(true)] // 设置假删除的值
bool IsDeleted { get; set; }
/// <summary>
/// 删除用户ID
/// </summary>
long? DeletedUserId { get; set; }
/// <summary>
/// 删除用户名称
/// </summary>
string DeletedUserName { get; set; }
/// <summary>
/// 删除时间
/// </summary>
DateTimeOffset? DeletedTime { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugarTest
{
[SugarTable("Special", TableDescription = "专题", IsDisabledDelete = true)]
public class Special : IDeleted
{
/// <summary>
/// 非自增ID
/// </summary>
[SugarColumn(ColumnDescription = "ID", IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 默认假删除
/// </summary>
[System.Text.Json.Serialization.JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
[SugarColumn(ColumnDescription = "默认假删除", DefaultValue = "false")]
public bool IsDeleted { get; set; }
/// <summary>
/// 删除用户ID
/// </summary>
[SugarColumn(ColumnDescription = "删除用户ID", IsOnlyIgnoreInsert = true, IsNullable = true)]
public long? DeletedUserId { get; set; }
/// <summary>
/// 删除用户
/// </summary>
[SugarColumn(ColumnDescription = "删除用户", IsNullable = true, IsOnlyIgnoreInsert = true)]
public string? DeletedUserName { get; set; }
/// <summary>
/// 删除时间
/// </summary>
[SugarColumn(ColumnDescription = "删除时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
public DateTimeOffset? DeletedTime { get; set; }
}
}