mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add user test case
This commit is contained in:
parent
692f9f5c8a
commit
e649049781
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitWeek.Init();
|
||||
UnitTestOneToOne.Init();
|
||||
Unitadfafafasd.Init();
|
||||
UnitSubToList.Init();
|
||||
|
38
Src/Asp.NetCore2/PgSqlTest/UserTestCases/UnitWeek.cs
Normal file
38
Src/Asp.NetCore2/PgSqlTest/UserTestCases/UnitWeek.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UnitWeek
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
var date = DateTime.Now.AddDays(i);
|
||||
var id = db.Insertable(new Order()
|
||||
{
|
||||
CreateTime = date,
|
||||
CustomId = 1,
|
||||
Name = "a",
|
||||
Price = 1
|
||||
})
|
||||
.ExecuteReturnIdentity();
|
||||
|
||||
var data1 = db.Queryable<Order>()
|
||||
.In(id).Select(it => it.CreateTime.DayOfWeek).Single();
|
||||
Console.WriteLine(db.Queryable<Order>()
|
||||
.In(id).Select(it => it.CreateTime).Single());
|
||||
if (data1 != date.DayOfWeek)
|
||||
{
|
||||
throw new Exception("DayOfWeek error");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user