Add unit test

This commit is contained in:
sunkaixuan 2022-11-28 19:27:31 +08:00
parent 5b280b8d2c
commit 3e1c03ed62

View File

@ -95,9 +95,25 @@ namespace OrmTest
{ {
throw new Exception("unit error"); throw new Exception("unit error");
} }
db.CodeFirst.InitTables<UnitDecmaildfa>();
db.DbMaintenance.TruncateTable<UnitDecmaildfa>();
db.Insertable(new UnitDecmaildfa() { Id = 1, Name = "a" }).ExecuteCommand();
var x1=db.Storageable(new UnitDecmaildfa() { Id = 1, Name = "a" }).ToStorage();
if (!x1.UpdateList.Any())
{
throw new Exception("unit error");
}
db.DbMaintenance.DropTable<UnitDecmaildfa>();
} }
public class UnitDecmaildfa
{
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
public decimal? Id { get; set; }
public string Name { get; set; }
}
public static List<T> Search<T>(SqlSugarClient db) where T : ISearch public static List<T> Search<T>(SqlSugarClient db) where T : ISearch