Add user test case

This commit is contained in:
sunkaixuan 2024-02-18 16:50:22 +08:00
parent 43f7aed701
commit 6855cba8fa
2 changed files with 39 additions and 0 deletions

View File

@ -33,6 +33,7 @@ namespace OrmTest
}
public static void Init()
{
UnitWeek.Init();
Unitadfaasdfaaa.Init();
Unitatadffaa1.Init();
UnitOneToManyNsdfafa.Init();

View 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");
}
}
}
}
}