Browse Source

Update unit

pull/14/head
sunkaixuan 3 years ago
parent
commit
e029494ba5
  1. 3
      Src/Asp.Net/SqliteTest/UnitTest/Main.cs
  2. 12
      Src/Asp.Net/SqliteTest/UnitTest/UCustom011.cs

3
Src/Asp.Net/SqliteTest/UnitTest/Main.cs

@ -31,7 +31,8 @@ namespace OrmTest
}
public static void Init()
{
UCustom01.Init();
UCustom011.Init();
UBulkCopy.Init();
Bulk();
Insert();

12
Src/Asp.Net/SqliteTest/UnitTest/UCustom011.cs

@ -13,16 +13,16 @@ namespace OrmTest
{
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();
var x1=db.Queryable<Order>().Select(it => (SqlFunc.GetDate() - SqlFunc.GetDate().AddYears(-1)).TotalDays).ToList();
var x2 = db.Queryable<Order>().Select(it => (SqlFunc.GetDate() - SqlFunc.GetDate().AddDays(-1)).TotalHours).ToList();
var x3 = db.Queryable<Order>().Select(it => (SqlFunc.GetDate() - SqlFunc.GetDate().AddHours(-1)).TotalMinutes).ToList();
var x4 = db.Queryable<Order>().Select(it => (SqlFunc.GetDate() - 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");
Check.Exception(x3.First()<=59|| x3.First() >=61, "unit error . UCustom011");
Check.Exception(x4.First() <= 59 || x4.First() >= 61, "unit error . UCustom011");
}
}

Loading…
Cancel
Save