public DbOutboxWriterTests() { _connection = new SqliteConnection($"Data Source={Guid.NewGuid():N};Mode=Memory;Cache=Shared"); _connection.Open(); var services = new ServiceCollection(); services .AddLoggerSubstitute() .AddDbContext <TestDbContext>( options => options .UseSqlite(_connection.ConnectionString)) .AddSilverback() .UseDbContext <TestDbContext>(); var serviceProvider = services.BuildServiceProvider( new ServiceProviderOptions { ValidateScopes = true }); _scope = serviceProvider.CreateScope(); _dbContext = _scope.ServiceProvider.GetRequiredService <TestDbContext>(); _dbContext.Database.EnsureCreated(); _queueWriter = new DbOutboxWriter(_scope.ServiceProvider.GetRequiredService <IDbContext>()); }
public DbOutboxWriterTests() { _connection = new SqliteConnection("DataSource=:memory:"); _connection.Open(); var services = new ServiceCollection(); services .AddNullLogger() .AddDbContext <TestDbContext>( options => options .UseSqlite(_connection)) .AddSilverback() .UseDbContext <TestDbContext>(); var serviceProvider = services.BuildServiceProvider( new ServiceProviderOptions { ValidateScopes = true }); _scope = serviceProvider.CreateScope(); _dbContext = _scope.ServiceProvider.GetRequiredService <TestDbContext>(); _dbContext.Database.EnsureCreated(); _queueWriter = new DbOutboxWriter(_scope.ServiceProvider.GetRequiredService <IDbContext>()); }