91 references to TestDbContext
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (91)
AspireEFPostgreSqlExtensionsTests.cs (30)
36
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
39
var
context = host.Services.GetRequiredService<
TestDbContext
>();
52
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql",
57
var
context = host.Services.GetRequiredService<
TestDbContext
>();
74
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
77
var
context = host.Services.GetRequiredService<
TestDbContext
>();
94
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql", configureDbContextOptions: optionsBuilder =>
104
var
context = host.Services.GetRequiredService<
TestDbContext
>();
136
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql", configureDbContextOptions: optionsBuilder =>
146
var
context = host.Services.GetRequiredService<
TestDbContext
>();
182
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql",
187
var
context = host.Services.GetRequiredService<
TestDbContext
>();
216
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql",
221
var
context = host.Services.GetRequiredService<
TestDbContext
>();
248
builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql");
252
var
context = host.Services.GetRequiredService<
TestDbContext
>();
274
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
278
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
281
var exception = Assert.Throws<InvalidOperationException>(() => builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql"));
297
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
301
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
304
var exception = Record.Exception(() => builder.AddNpgsqlDbContext<
TestDbContext
>("npgsql"));
ConformanceTests.cs (7)
16
public class ConformanceTests : ConformanceTests<
TestDbContext
, NpgsqlEntityFrameworkCorePostgreSQLSettings>, IClassFixture<PostgreSQLContainerFixture>
94
=> builder.AddNpgsqlDbContext<
TestDbContext
>(key ?? "postgres", configure);
105
protected override void TriggerActivity(
TestDbContext
service)
119
IDbContextPool<
TestDbContext
>? pool = host.Services.GetService<IDbContextPool<
TestDbContext
>>();
129
TestDbContext
? dbContext = host.Services.GetService<
TestDbContext
>();
ConformanceTests_TypeSpecificConfig.cs (1)
19
new($"Aspire:Npgsql:EntityFrameworkCore:PostgreSQL:{typeof(
TestDbContext
).Name}:ConnectionString", ConnectionString)
EnrichNpgsqlTests.cs (50)
28
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
29
builder.EnrichNpgsqlDbContext<
TestDbContext
>(configure);
37
var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichNpgsqlDbContext<
TestDbContext
>());
46
builder.Services.AddDbContext<
TestDbContext
>(options => options.UseNpgsql(ConnectionString));
48
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
64
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
73
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
76
var
context = host.Services.GetRequiredService<
TestDbContext
>();
100
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
109
builder.EnrichNpgsqlDbContext<
TestDbContext
>(settings => settings.CommandTimeout = 456);
112
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
121
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
127
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
130
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
133
var
context = host.Services.GetRequiredService<
TestDbContext
>();
157
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
166
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
169
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
172
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
177
var
context = host.Services.GetRequiredService<
TestDbContext
>();
201
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
210
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
213
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
216
var
context = host.Services.GetRequiredService<
TestDbContext
>();
237
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(optionsBuilder =>
243
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
246
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
255
builder.Services.AddDbContext<ITestDbContext,
TestDbContext
>(optionsBuilder =>
261
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
263
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
268
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
277
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
283
builder.EnrichNpgsqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = true);
286
var
context = host.Services.GetRequiredService<
TestDbContext
>();
306
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
312
builder.EnrichNpgsqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
315
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
324
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
330
builder.EnrichNpgsqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
333
var
context = host.Services.GetRequiredService<
TestDbContext
>();
357
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
363
builder.EnrichNpgsqlDbContext<
TestDbContext
>();
TestDbContext.cs (3)
10
public DbSet<
TestDbContext
.CatalogBrand> CatalogBrands { get; }
15
public TestDbContext(DbContextOptions<
TestDbContext
> options) : base(options)
20
public DbContextOptions<
TestDbContext
> Options { get; }