Add user test cases

This commit is contained in:
sunkaixuan 2023-11-20 03:55:20 +08:00
parent 06db3277be
commit ea2fd3ccd9

View File

@ -29,7 +29,39 @@ namespace OrmTest
if (x[1].Length != 18 && x[1].Scale != 2) throw new Exception("unit test error"); if (x[1].Length != 18 && x[1].Scale != 2) throw new Exception("unit test error");
if (x[2].Length != 0 && x[2].Scale != 0) throw new Exception("unit test error"); if (x[2].Length != 0 && x[2].Scale != 0) throw new Exception("unit test error");
Db.CodeFirst.InitTables<UnitIndextest>(); Db.CodeFirst.InitTables<UnitIndextest>();
Db.CodeFirst.InitTables<UnitDropColumnTest>();
Db.CodeFirst.InitTables<UNITDROPCOLUMNTEST>();
var column= Db.DbMaintenance.GetColumnInfosByTableName("UNITDROPCOLUMNTEST", false);
if (column.Count != 3)
{
throw new Exception("unit error");
}
var db = Db;
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
{
SqliteCodeFirstEnableDropColumn=true
};
db.CodeFirst.InitTables<UNITDROPCOLUMNTEST>();
var column2 = db.DbMaintenance.GetColumnInfosByTableName("UNITDROPCOLUMNTEST", false);
if (column2.Count != 2)
{
throw new Exception("unit error");
}
} }
public class UnitDropColumnTest
{
public int Id { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
}
public class UNITDROPCOLUMNTEST
{
public int Id { get; set; }
public string Name { get; set; }
}
[SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)] [SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)]
public class UnitIndextest public class UnitIndextest
{ {