Church.Net.API/TestProject/DateTimeTest.cs
2022-09-08 08:04:32 -07:00

44 lines
1.3 KiB
C#

using Church.Net.DAL.EF;
using Church.Net.DAL.EFCoreDBF;
using Church.Net.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
using WebAPI.Logics;
using WebAPI.Logics.Core;
using WebAPI.Logics.Interface;
using WebAPI.Services;
using WebAPI.Services.AutoReplyCommands;
using WebAPI.Services.Interfaces;
namespace TestProject
{
public class DateTimeTest : TestBase
{
private ICrudLogic<NewVisitor>? logic;
private LineAutoBotService? botLogic;
private ICrudDAL<CellGroupRoutineEvent>? groupEventDALC;
[SetUp]
public void Setup()
{
base.Setup();
logic = serviceProvider.GetService<ICrudLogic<NewVisitor>>();
botLogic = serviceProvider.GetService<LineAutoBotService>();
groupEventDALC = serviceProvider.GetService<ICrudDAL<CellGroupRoutineEvent>>();
}
[Test]
public void GetComingEvent()
{
var _event = groupEventDALC.GetDbSet().Where(e => e.Time > DateTime.Today).FirstOrDefault();
Assert.IsNotNull(_event);
var utcToday = DateTime.Today.ToUniversalTime();
_event = groupEventDALC.GetDbSet().Where(e => e.Time >= DateTime.UtcNow).FirstOrDefault();
Assert.IsNull(_event);
}
}
}