mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Add unit test
This commit is contained in:
parent
d05f3456d0
commit
8651e08dc9
@ -96,6 +96,7 @@
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="UnitTest\UCustom01.cs" />
|
||||
<Compile Include="UnitTest\UCustom02.cs" />
|
||||
<Compile Include="UnitTest\UCustom03.cs" />
|
||||
<Compile Include="UnitTest\UDelete.cs" />
|
||||
<Compile Include="UnitTest\UFastest.cs" />
|
||||
<Compile Include="UnitTest\UConfig.cs" />
|
||||
|
@ -33,6 +33,7 @@ namespace OrmTest
|
||||
{
|
||||
UCustom01.Init();
|
||||
UCustom02.Init();
|
||||
UCustom03.Init();
|
||||
SubQueryTest();
|
||||
UConfig();
|
||||
DeleteTest();
|
||||
|
42
Src/Asp.Net/SqlServerTest/UnitTest/UCustom03.cs
Normal file
42
Src/Asp.Net/SqlServerTest/UnitTest/UCustom03.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UCustom03
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
Demo1();
|
||||
}
|
||||
|
||||
private static void Demo1()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.NoEqual, FieldValue = "1" });
|
||||
conModels.Add(new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.IsNot, FieldValue = null });// id is not null
|
||||
|
||||
conModels.Add(new ConditionalTree()
|
||||
{
|
||||
ConditionalList = new List<KeyValuePair<WhereType, IConditionalModel>>()// (id=1 or id=2 and id=1)
|
||||
{
|
||||
//new KeyValuePair<WhereType, ConditionalModel>( WhereType.And ,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "1" }),
|
||||
new KeyValuePair<WhereType, IConditionalModel> (WhereType.Or,new ConditionalModel() { FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "2" }),
|
||||
new KeyValuePair<WhereType, IConditionalModel> ( WhereType.And, new ConditionalTree(){
|
||||
ConditionalList=new List<KeyValuePair<WhereType, IConditionalModel>>(){
|
||||
new KeyValuePair<WhereType, IConditionalModel>(WhereType.And,new ConditionalModel(){
|
||||
FieldName = "id", ConditionalType = ConditionalType.Equal, FieldValue = "1"
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
var list6 =db .Queryable<Order>().Where(conModels).ToList();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user