mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Update unit test
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
<Compile Include="UnitTest\UBulkCopy.cs" />
|
||||
<Compile Include="UnitTest\UCodeFirst.cs" />
|
||||
<Compile Include="UnitTest\UCustom01.cs" />
|
||||
<Compile Include="UnitTest\UCustom011.cs" />
|
||||
<Compile Include="UnitTest\UCustom02.cs" />
|
||||
<Compile Include="UnitTest\UInsert.cs" />
|
||||
<Compile Include="UnitTest\UJson.cs" />
|
||||
|
31
Src/Asp.Net/SqliteTest/UnitTest/UCustom011.cs
Normal file
31
Src/Asp.Net/SqliteTest/UnitTest/UCustom011.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
|
||||
{
|
||||
public class UCustom011
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
db.Queryable<Order>().Where(it => (it.CreateTime - SqlFunc.GetDate()).TotalDays > 1).ToList();
|
||||
var x1=db.Queryable<Order>().Select(it => (DateTime.Now - SqlFunc.GetDate().AddYears(-1)).TotalDays).ToList();
|
||||
var x2 = db.Queryable<Order>().Select(it => (DateTime.Now - SqlFunc.GetDate().AddDays(-1)).TotalHours).ToList();
|
||||
var x3 = db.Queryable<Order>().Select(it => (DateTime.Now - SqlFunc.GetDate().AddHours(-1)).TotalMinutes).ToList();
|
||||
var x4 = db.Queryable<Order>().Select(it => (DateTime.Now - SqlFunc.GetDate().AddMinutes(-1)).TotalSeconds).ToList();
|
||||
if (x1.Any())
|
||||
{
|
||||
Check.Exception(x1.First()!=365, "unit error . UCustom011");
|
||||
Check.Exception(x2.First() != 24, "unit error . UCustom011");
|
||||
Check.Exception(x3.First() != 60, "unit error . UCustom011");
|
||||
Check.Exception(x4.First() != 60, "unit error . UCustom011");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user