mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add user test case
This commit is contained in:
parent
3e52da38b3
commit
2ecae61cb5
@ -187,9 +187,37 @@ namespace OrmTest
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
}
|
||||
TestIdentity();
|
||||
}
|
||||
|
||||
private static void TestIdentity()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
db.CodeFirst.InitTables<UnitadfasyyafdaIdentity>();
|
||||
db.DbMaintenance.TruncateTable<UnitadfasyyafdaIdentity>();
|
||||
db.Insertable(new UnitadfasyyafdaIdentity() { Id = 1, Name = "a", Name2 = "a11" }).ExecuteCommand();
|
||||
db.Insertable(new UnitadfasyyafdaIdentity() { Id = 2, Name = "a2", Name2 = "a22" }).ExecuteCommand();
|
||||
var list10 = db.Queryable<UnitadfasyyafdaIdentity>().ToDataTable();
|
||||
db.DbMaintenance.TruncateTable<UnitadfasyyafdaIdentity>();
|
||||
db.Fastest<System.Data.DataTable>().AS("UnitadfasyyafdaIdentity").BulkCopy(list10);
|
||||
var list11 = db.Queryable<UnitadfasyyafdaIdentity>().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 UnitadfasyyafdaIdentity
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
}
|
||||
public class Unitadfasyyafda
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user