mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Add unit test
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="Demo\DemoJ_Report.cs" />
|
||||
<Compile Include="UnitTest\UBulkCopy.cs" />
|
||||
<Compile Include="UnitTest\UCustom06.cs" />
|
||||
<Compile Include="UnitTest\UInsert.cs" />
|
||||
<Compile Include="UnitTest\UnitCustom01.cs" />
|
||||
<Compile Include="UnitTest\UQueue.cs" />
|
||||
|
@@ -32,6 +32,7 @@ namespace OrmTest
|
||||
public static void Init()
|
||||
{
|
||||
UnitCustom01.Init();
|
||||
UCustom06.Init();
|
||||
Bulk();
|
||||
Insert();
|
||||
Queue();
|
||||
|
45
Src/Asp.Net/MySqlTest/UnitTest/UCustom06.cs
Normal file
45
Src/Asp.Net/MySqlTest/UnitTest/UCustom06.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom06
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
|
||||
db.CodeFirst.InitTables<Unit06>();
|
||||
db.Insertable(new Unit06() { Company = "1", Name = "2", Work = "3" }).ExecuteCommand();
|
||||
var list = db.Queryable<Unit06>().Select(a => new UnitPeople
|
||||
{
|
||||
Name = a.Name,
|
||||
Job = new UnitJobClass { Company = a.Company, Work = a.Work }
|
||||
}
|
||||
).ToList();
|
||||
Check.Exception(list.First().Job.Company != "1", "unit error");
|
||||
|
||||
}
|
||||
public class Unit06
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Company { get; set; }
|
||||
public string Work { get; set; }
|
||||
}
|
||||
public class UnitPeople
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public UnitJobClass Job { get; set; }
|
||||
}
|
||||
|
||||
public class UnitJobClass
|
||||
{
|
||||
public string Company { get; set; }
|
||||
public string Work { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user