mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Add unit test
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
<Compile Include="UserTestCases\Cases\UnitAny.cs" />
|
<Compile Include="UserTestCases\Cases\UnitAny.cs" />
|
||||||
<Compile Include="UserTestCases\Cases\Unitasdfas2yy.cs" />
|
<Compile Include="UserTestCases\Cases\Unitasdfas2yy.cs" />
|
||||||
<Compile Include="UserTestCases\Cases\Unitasdfasdfa1.cs" />
|
<Compile Include="UserTestCases\Cases\Unitasdfasdfa1.cs" />
|
||||||
|
<Compile Include="UserTestCases\Cases\UnitFADFASFAY.cs" />
|
||||||
<Compile Include="UserTestCases\Config.cs" />
|
<Compile Include="UserTestCases\Config.cs" />
|
||||||
<Compile Include="UserTestCases\Cases.cs" />
|
<Compile Include="UserTestCases\Cases.cs" />
|
||||||
<Compile Include="UserTestCases\Demo\Demo0_SqlSugarClient.cs" />
|
<Compile Include="UserTestCases\Demo\Demo0_SqlSugarClient.cs" />
|
||||||
|
@@ -31,6 +31,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UnitFADFASFAY.Init();
|
||||||
UnitOneToMany.Init();
|
UnitOneToMany.Init();
|
||||||
UnitOneToMany2.Init();
|
UnitOneToMany2.Init();
|
||||||
UnitFilterUpdate.Init();
|
UnitFilterUpdate.Init();
|
||||||
|
31
Src/Asp.Net/SqliteTest/UserTestCases/Cases/UnitFADFASFAY.cs
Normal file
31
Src/Asp.Net/SqliteTest/UserTestCases/Cases/UnitFADFASFAY.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
internal class UnitFADFASFAY
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
db.CodeFirst.InitTables<Unitfaafafa>();
|
||||||
|
db.DbMaintenance.TruncateTable<Unitfaafafa>();
|
||||||
|
db.Insertable(new Unitfaafafa() { DateTime = Convert.ToDateTime("2020-01-01") }).ExecuteCommand();
|
||||||
|
db.Insertable(new Unitfaafafa() { DateTime = Convert.ToDateTime("2020-01-02").AddHours(1) }).ExecuteCommand();
|
||||||
|
db.Insertable(new Unitfaafafa() { DateTime = Convert.ToDateTime("2020-01-03").AddHours(1) }).ExecuteCommand();
|
||||||
|
var cons = new List<IConditionalModel>() {
|
||||||
|
new ConditionalModel(){ ConditionalType=ConditionalType.RangeDate, FieldName="DateTime", FieldValue="2020-01-01,2020-01-02" }
|
||||||
|
};
|
||||||
|
var data= db.Queryable<Unitfaafafa>().Where(cons).ToList();
|
||||||
|
if (data.Count != 2) throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
public class Unitfaafafa
|
||||||
|
{
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user