Add unit test

This commit is contained in:
sunkaixuan 2023-08-26 13:52:20 +08:00
parent 1e2ee8ccf8
commit 3f8674e754

View File

@ -159,7 +159,7 @@ namespace OrmTest
throw new Exception("uint error"); throw new Exception("uint error");
} }
Db.CodeFirst.InitTables<unitBools2>(); Db.CodeFirst.InitTables<unitBools2>();
Db.DbMaintenance.TruncateTable<unitBools2>(); Db.DbMaintenance.TruncateTable<unitBools2>();
Db.Fastest<unitBools2>().BulkCopy(new List<unitBools2>() { Db.Fastest<unitBools2>().BulkCopy(new List<unitBools2>() {
new unitBools2() new unitBools2()
{ {
@ -167,14 +167,28 @@ namespace OrmTest
null1 = null, null1 = null,
true1 = true, true1 = true,
id = 1 id = 1
}}); }});
var data3= Db.Queryable<unitBools2>().First(); var data3= Db.Queryable<unitBools2>().First();
if (data3.false1 != null || data2.true1 != true || data2.null1 != null) if (data3.false1 != null || data2.true1 != true || data2.null1 != null)
{ {
throw new Exception("uint error"); throw new Exception("uint error");
} }
Db.CodeFirst.InitTables<unitBytedfa>();
Db.Fastest<unitBytedfa>().BulkCopy(new List<unitBytedfa>() {
new unitBytedfa(){ aaa=new byte[]{ 1,2,3,4,3,1} }
});
var data4=Db.Queryable<unitBytedfa>().First();
if (string.Join("", data4.aaa) != "123431")
{
throw new Exception("uint error");
}
} }
} }
public class unitBytedfa
{
public byte[] aaa { get; set; }
}
public class unitBools2 public class unitBools2
{ {
[SqlSugar.SugarColumn(IsPrimaryKey = true)] [SqlSugar.SugarColumn(IsPrimaryKey = true)]