Initial commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
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 FamilyMemberTest: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 GetAll()
|
||||
{
|
||||
//attendeeDALC.CheckExist(new CellGroupRoutineEventAttendee());
|
||||
//var list = logic.GetAll();
|
||||
//botLogic.AutoReply(null);
|
||||
Assert.Pass();
|
||||
}
|
||||
[Test]
|
||||
public void UtcUpdate()
|
||||
{
|
||||
var group = groupEventDALC.GetAll().FirstOrDefault();
|
||||
group.Time = new DateTime(2022,8,26,19,30,0);
|
||||
Assert.AreNotEqual(DateTimeKind.Utc, group.Time.Kind);
|
||||
groupEventDALC.Update(group);
|
||||
Assert.AreEqual(DateTimeKind.Utc, group.Time.Kind);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using LineMessaging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
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 LineMessageTest : TestBase
|
||||
{
|
||||
private ICrudLogic<NewVisitor>? logic;
|
||||
private LineAutoBotService? botLogic;
|
||||
private ICrudDAL<CellGroupRoutineEvent>? groupEventDALC;
|
||||
private const string ACCESS_TOKEN = "WFAyMvMEZ86cfMJIAzE+yklUZGpeS/jFYTeL9a9O35QR83oNMmwaUJfyEe48Kegadz0BArDdBoySxs479U1pwTHtlyH+Sm4jqlz8BwukX/Hsa4D1fX03Qn4zFu7TwPFKWFXnZbWq89Yg0iNzjpfTNwdB04t89/1O/w1cDnyilFU=";
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
base.Setup();
|
||||
|
||||
logic = serviceProvider.GetService<ICrudLogic<NewVisitor>>();
|
||||
groupEventDALC = serviceProvider.GetService<ICrudDAL<CellGroupRoutineEvent>>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendTextMessage()
|
||||
{
|
||||
var test = new LineMessagingClient();
|
||||
string text = "$$$$Menu Item";
|
||||
var textMessage = new LineTextMessage() { Text = text,Emojis=new List<Emoji>() };
|
||||
|
||||
textMessage.AddEmoji(0, "5ac1bfd5040ab15980c9b435", "001");
|
||||
textMessage.AddEmoji(2, "5ac1bfd5040ab15980c9b435", "001");
|
||||
textMessage.AddEmoji(3, "5ac1bfd5040ab15980c9b435", "001");
|
||||
|
||||
//var task= test.PushMessage(EnumHelper.EnumToDescriptionString(LineGroup.Chris), textMessage);
|
||||
|
||||
Task task = Task.Run(async () => await test.PushMessage(EnumHelper.EnumToDescriptionString(LineGroup.Chris), textMessage)); ;
|
||||
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void TestEnumStringConverter()
|
||||
{
|
||||
|
||||
var result= JsonConvert.SerializeObject(new LineFlexBox(), new JsonSerializerSettings()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
Converters = new List<JsonConverter> { new StringEnumConverter { CamelCaseText = true } }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
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 TestBase
|
||||
{
|
||||
public virtual void Setup()
|
||||
{
|
||||
|
||||
var services = new ServiceCollection();
|
||||
services.AddDbContext<ChurchNetContext>(options =>
|
||||
options.UseNpgsql(
|
||||
//Configuration.GetConnectionString()
|
||||
"Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124"
|
||||
));
|
||||
|
||||
services.AddTransient<LineAutoBotService>();
|
||||
services.AddTransient<IAutoReplyCommand, ArChurchInfo>();
|
||||
services.AddTransient<IAutoReplyCommand, ArArkCellGroupInfo>();
|
||||
services.AddTransient<IAutoReplyCommand, ArArkCellGroupDinner>();
|
||||
services.AddSingleton<VideoDownloadLogic>();
|
||||
services.AddSingleton<LogicService>();
|
||||
services.AddScoped(typeof(ICrudLogic<>), typeof(LogicBase<>));
|
||||
services.AddScoped(typeof(ICrudDAL<>), typeof(CrudDALCBase<>));
|
||||
services.AddScoped(typeof(ICombinedKeyCrudLogic<>), typeof(CombinedKeyLogicBase<>));
|
||||
serviceProvider = services.BuildServiceProvider();
|
||||
}
|
||||
protected ServiceProvider serviceProvider { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Church.Net.DAL.EFCoreDBF\Church.Net.DAL.EFCoreDBF.csproj" />
|
||||
<ProjectReference Include="..\WebAPI\WebAPI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
global using NUnit.Framework;
|
||||
Reference in New Issue
Block a user