public XunitKnstArchSql() { var services = new ServiceCollection(); services.AddKnstArchitectureSql(); services.AddTransient <IDbConnection>(sp => DbConnectionMoq.GetMemorySqlite()); var serviceProvider = services.BuildServiceProvider(); ServiceScope = serviceProvider.CreateScope(); ServiceProvider = ServiceScope.ServiceProvider; }
public XunitKnstArchEF() { var services = new ServiceCollection(); services.TryAddKnstArchitecture(); services.AddTransient <ITestEFDbSession, TestEFDbSession>(); services.AddTransient <IEFCoreDbSession>(sp => sp.GetRequiredService <ITestEFDbSession>()); services.AddScoped <ITestEFUnitOfWork, TestEFUnitOfWork>(); services.AddScoped <IEFCoreUnitOfWork>(sp => sp.GetRequiredService <ITestEFUnitOfWork>()); services.TryAddKnstDbContexts(); services.AddTransient <IDbConnection>(sp => DbConnectionMoq.GetMemorySqlite()); var serviceProvider = services.BuildServiceProvider(); ServiceScope = serviceProvider.CreateScope(); ServiceProvider = ServiceScope.ServiceProvider; }