2024-05-02 15:24:13 -07:00

41 lines
1.6 KiB
C#

using Church.Net.DAL.EF;
using Church.Net.DAL.EFCoreDBF.Core;
using Church.Net.DAL.EFCoreDBF.Interface;
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.68.55;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; }
}
}