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(options => options.UseNpgsql( //Configuration.GetConnectionString() "Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124" )); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddSingleton(); services.AddSingleton(); 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; } } }