mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add unit test
This commit is contained in:
parent
4389ee561a
commit
2d2a1ac7c1
@ -85,6 +85,7 @@
|
|||||||
<Compile Include="UnitTest\UCodeFirst.cs" />
|
<Compile Include="UnitTest\UCodeFirst.cs" />
|
||||||
<Compile Include="UnitTest\UCustom01.cs" />
|
<Compile Include="UnitTest\UCustom01.cs" />
|
||||||
<Compile Include="UnitTest\UCustom011.cs" />
|
<Compile Include="UnitTest\UCustom011.cs" />
|
||||||
|
<Compile Include="UnitTest\UCustom02.cs" />
|
||||||
<Compile Include="UnitTest\UDelete.cs" />
|
<Compile Include="UnitTest\UDelete.cs" />
|
||||||
<Compile Include="UnitTest\UJson.cs" />
|
<Compile Include="UnitTest\UJson.cs" />
|
||||||
<Compile Include="UnitTest\Updateable.cs" />
|
<Compile Include="UnitTest\Updateable.cs" />
|
||||||
|
@ -34,7 +34,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UCustom02.Init();
|
||||||
UCustom01.Init();
|
UCustom01.Init();
|
||||||
DeleteTest();
|
DeleteTest();
|
||||||
CodeFirst();
|
CodeFirst();
|
||||||
|
38
Src/Asp.Net/OracleTest/UnitTest/UCustom02.cs
Normal file
38
Src/Asp.Net/OracleTest/UnitTest/UCustom02.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
public class UCustom02
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
//建表
|
||||||
|
if (!db.DbMaintenance.IsAnyTable("Test001", false))
|
||||||
|
{
|
||||||
|
db.CodeFirst.InitTables<UnitTest001>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var dt = DateTime.Now;
|
||||||
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
{
|
||||||
|
var dt1 = pars[0];
|
||||||
|
};
|
||||||
|
//用例代码
|
||||||
|
var result = db.Insertable(new UnitTest001() { id = dt }).ExecuteCommand();//用例代码
|
||||||
|
var res = db.Queryable<UnitTest001>().WhereClass(new UnitTest001() { id = dt }).ToList();
|
||||||
|
if (res.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class UnitTest001
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnDataType = "TIMESTAMP")]
|
||||||
|
public DateTime id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user