mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add unit test
This commit is contained in:
parent
e49996a392
commit
a3614073a2
@ -80,6 +80,7 @@
|
|||||||
<Compile Include="Models\ViewOrder.cs" />
|
<Compile Include="Models\ViewOrder.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UnitTest\UnitStorageableBool.cs" />
|
||||||
<Compile Include="UnitTest\UCustom03.cs" />
|
<Compile Include="UnitTest\UCustom03.cs" />
|
||||||
<Compile Include="UnitTest\Main.cs" />
|
<Compile Include="UnitTest\Main.cs" />
|
||||||
<Compile Include="UnitTest\UAdo.cs" />
|
<Compile Include="UnitTest\UAdo.cs" />
|
||||||
|
@ -34,6 +34,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UnitStorageableBool.Init();
|
||||||
UCustom03.Init();
|
UCustom03.Init();
|
||||||
UCustom02.Init();
|
UCustom02.Init();
|
||||||
UCustom01.Init();
|
UCustom01.Init();
|
||||||
|
41
Src/Asp.Net/OracleTest/UnitTest/UnitStorageableBool.cs
Normal file
41
Src/Asp.Net/OracleTest/UnitTest/UnitStorageableBool.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
public class UnitStorageableBool
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
//建表
|
||||||
|
if (!db.DbMaintenance.IsAnyTable("Test0011", false))
|
||||||
|
{
|
||||||
|
db.CodeFirst.InitTables<Test001>();
|
||||||
|
}
|
||||||
|
db.Aop.OnError = (exp) =>//SQL报错
|
||||||
|
{
|
||||||
|
//Console.WriteLine($"SqlSugar[Error]:{UtilMethods.GetSqlString(DbType.SqlServer, exp.Sql, exp.Parametres)}" + Environment.NewLine);
|
||||||
|
};
|
||||||
|
|
||||||
|
//用例代码
|
||||||
|
var result = db.Insertable(new Test001() { id = true }).ExecuteCommand();//用例代码
|
||||||
|
var result1 = db.Insertable(new Test001() { id = false }).ExecuteCommand();//用例代码
|
||||||
|
var res = db.Storageable(new Test001() { id1 = false, id = false }).WhereColumns(x => x.id1)
|
||||||
|
.SplitUpdate(x => x.Any()).ToStorage();
|
||||||
|
res.AsUpdateable.ExecuteCommand();
|
||||||
|
//Console.WriteLine(result);
|
||||||
|
//Console.WriteLine("用例跑完");
|
||||||
|
// Console.ReadKey();
|
||||||
|
}
|
||||||
|
//建类
|
||||||
|
[SugarTable("Test0011")]
|
||||||
|
public class Test001
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnDataType = "NUMBER(1)", SqlParameterDbType = System.Data.DbType.Int16)]
|
||||||
|
public bool id { get; set; }
|
||||||
|
[SugarColumn(ColumnDataType = "NUMBER(1)", SqlParameterDbType = System.Data.DbType.Int16)]
|
||||||
|
public bool id1 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user