mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add unit test
This commit is contained in:
parent
5b203e268c
commit
8391962d6c
@ -97,6 +97,7 @@
|
||||
<Compile Include="Models\OrderItem.cs" />
|
||||
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="UnitTest\UnitSub.cs" />
|
||||
<Compile Include="UnitTest\UnitUpdateNavN3.cs" />
|
||||
<Compile Include="UnitTest\UnitOneToOne12.cs" />
|
||||
<Compile Include="UnitTest\Models\poetry_video_comment.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitSub.Init();
|
||||
UnitUpdateNavN3.Init();
|
||||
UnitOneToOne12.Init();
|
||||
UnitInsertNav3.Init();
|
||||
|
30
Src/Asp.Net/SqlServerTest/UnitTest/UnitSub.cs
Normal file
30
Src/Asp.Net/SqlServerTest/UnitTest/UnitSub.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UnitSub
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var sql=db.Queryable<Order>()
|
||||
.Select(it => new
|
||||
{
|
||||
id= SqlFunc.Subqueryable<SubEntity>().Sum(o => o.Id)
|
||||
}).ToSql();
|
||||
if (!sql.Key.Contains("id_1"))
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
}
|
||||
public class SubEntity
|
||||
{
|
||||
[SqlSugar.SugarColumn(ColumnName ="id_1")]
|
||||
public decimal Id { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user