Add user test case

This commit is contained in:
sunkaixuan 2024-02-03 13:06:52 +08:00
parent 821f31add7
commit 3e52da38b3

View File

@ -171,15 +171,36 @@ namespace OrmTest
new UnitDateOffsetTimex() { offsetTime = DateTimeOffset.Now },
new UnitDateOffsetTimex() { offsetTime = DateTimeOffset.Now }}).ExecuteCommand();
var dt = Db.Ado.GetDataTable("select * from UnitDateOffsetTimex");
db.CodeFirst.InitTables<Unitadfasyyafda>();
db.DbMaintenance.TruncateTable<Unitadfasyyafda>();
db.Insertable(new Unitadfasyyafda() { Id = 1, Name = "a" }).ExecuteCommand();
db.Insertable(new Unitadfasyyafda() { Id = 2, Name = "a2" }).ExecuteCommand();
var list10=db.Queryable<Unitadfasyyafda>().ToDataTable();
db.DbMaintenance.TruncateTable<Unitadfasyyafda>();
db.Fastest<System.Data.DataTable>().AS("Unitadfasyyafda").BulkCopy(list10);
var list11=db.Queryable<Unitadfasyyafda>().ToList();
if (list11.First().Id != 1 || list11.Last().Name != "a2")
{
throw new Exception("unit error");
}
if (list11.First().Name != "a" || list11.Last().Id != 2)
{
throw new Exception("unit error");
}
}
}
public class UnitDateOffsetTimex
{
public DateTimeOffset offsetTime { get; set; }
}
public class Unitadfasyyafda
{
public int Id { get; set; }
public string Name { get; set; }
}
public class UnitDateOffsetTimex
{
public DateTimeOffset offsetTime { get; set; }
}
public class UnitBool01
public class UnitBool01
{
public bool Bool { get; set; }
}
@ -193,7 +214,7 @@ namespace OrmTest
{
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
public int Id { get; set; }
[SqlSugar.SugarColumn(ColumnDataType ="tinyint",Length =1,IsNullable =true)]
[SqlSugar.SugarColumn(ColumnDataType = "tinyint", Length = 1, IsNullable = true)]
public bool? table { get; set; }
}
public class UnitTable001
@ -216,7 +237,7 @@ namespace OrmTest
}
public class UnitIdentity1
{
[SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
public string Name { get; set; }
}