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
8537343a77
commit
6f719236b6
@ -86,6 +86,7 @@
|
||||
<Compile Include="Models\Unit\Custom1\PurchaseDetailModel.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="Demo\DemoJ_Report.cs" />
|
||||
<Compile Include="UnitTest\UCustom07.cs" />
|
||||
<Compile Include="UnitTest\UDelete.cs" />
|
||||
<Compile Include="UnitTest\UBulkCopy.cs" />
|
||||
<Compile Include="UnitTest\UCustom011.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UCustom07.Init();
|
||||
UnitTestReturnPkList.Init();
|
||||
UnitSameKeyBug.Init();
|
||||
UOneManyMany.init();
|
||||
|
39
Src/Asp.Net/MySqlTest/UnitTest/UCustom07.cs
Normal file
39
Src/Asp.Net/MySqlTest/UnitTest/UCustom07.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom07
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var x=db.Deleteable(new Date1() { dateTime = DateTime.Now,name="a" }).ToSql();
|
||||
if (x.Key.Contains("//") || x.Key.Contains("\\")) { throw new Exception("unit error"); }
|
||||
var x2 = db.Deleteable(new Date2() { dateTime = DateTime.Now, name = "a" }).ToSql();
|
||||
if (x2.Key.Contains("//") || x.Key.Contains("\\")) { throw new Exception("unit error"); }
|
||||
db.CodeFirst.InitTables<Date2, Date1>();
|
||||
db.Deleteable(new Date1() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.Deleteable(new Date2() { dateTime = DateTime.Now, name = "a" }).ExecuteCommand();
|
||||
db.DbMaintenance.DropTable("Date1");
|
||||
db.DbMaintenance.DropTable("Date2");
|
||||
}
|
||||
}
|
||||
public class Date2
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public DateTime dateTime { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
}
|
||||
public class Date1
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
||||
public DateTime dateTime { get; set; }
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user