mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Update unit test
This commit is contained in:
@@ -11,36 +11,36 @@ namespace OrmTest
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var x=db.Deleteable(new Date1() { dateTime = DateTime.Now,name="a" }).ToSql();
|
||||
var x=db.Deleteable(new Date111() { dateTime = DateTime.Now,name="a" }).ToSql();
|
||||
if (x.Key.Contains("//") || x.Key.Contains("\\")) { throw new Exception("unit error"); }
|
||||
var x2 = db.Deleteable(new Date2() { dateTime = DateTime.Now, name = "a" }).ToSql();
|
||||
var x2 = db.Deleteable(new Date222() { dateTime = DateTime.Now, name = "a" }).ToSql();
|
||||
if (x2.Key.Contains("//") || x.Key.Contains("\\")) { throw new Exception("unit error"); }
|
||||
db.CodeFirst.InitTables<Date2, Date1, Date3>();
|
||||
db.Deleteable(new Date1() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.Deleteable(new Date2() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.Insertable(new Date3() { name1 = "a" }).ExecuteCommand();
|
||||
db.Updateable(new Date3() { name1 = "a" }).ExecuteCommand();
|
||||
db.DbMaintenance.DropTable("Date1");
|
||||
db.DbMaintenance.DropTable("Date2");
|
||||
db.DbMaintenance.DropTable("Date3");
|
||||
db.CodeFirst.InitTables<Date222, Date111, Date333>();
|
||||
db.Deleteable(new Date111() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.Deleteable(new Date222() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.Insertable(new Date333() { name1 = "a" }).ExecuteCommand();
|
||||
db.Updateable(new Date333() { name1 = "a" }).ExecuteCommand();
|
||||
db.DbMaintenance.DropTable("Date111");
|
||||
db.DbMaintenance.DropTable("Date222");
|
||||
db.DbMaintenance.DropTable("Date333");
|
||||
}
|
||||
}
|
||||
|
||||
public class Date3
|
||||
public class Date333
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, ColumnName = "date Time")]
|
||||
public DateTime dateTime { get; set; }
|
||||
[SqlSugar.SugarColumn( ColumnName = "name 1")]
|
||||
public string name1 { get; set; }
|
||||
}
|
||||
public class Date2
|
||||
public class Date222
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public DateTime dateTime { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Date1
|
||||
public class Date111
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
||||
public DateTime dateTime { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user