Add unit test

This commit is contained in:
sunkaixuan
2023-08-30 20:04:57 +08:00
parent 5545556f80
commit 0ce08f77cd

View File

@@ -40,9 +40,33 @@ namespace OrmTest
var list2=db.Queryable<CodeFirstTable22x2>().ToList();
db.CodeFirst.InitTables<CodeFirstUnitrew>();
db.Insertable(new CodeFirstUnitrew() { Index = 1 }).ExecuteCommand();
db = NewUnitTest.Db;
db.CodeFirst.InitTables<Unit00Z11C12>();
db.DbMaintenance.TruncateTable<Unit00Z11C12>();
db.Insertable(new Unit00Z11C12() { type = UnitType.a, type2 = UnitType.b }).ExecuteCommand();
var list3=db.Queryable<Unit00Z11C12>().Select(it => new DTO
{
unit00Z11C12 = it
}).ToList();
Console.WriteLine("#### CodeFirst end ####");
}
}
public enum UnitType
{
a=0,
b=2
}
public class DTO
{
public Unit00Z11C12 unit00Z11C12 { get; set; }
}
public class Unit00Z11C12
{
[SqlSugar.SugarColumn( IsNullable = true)]
public UnitType type { get; set; }
[SqlSugar.SugarColumn( IsNullable = true)]
public UnitType? type2 { get; set; }
}
/// <summary>
/// 测试表
/// </summary>