89 references to TestDbContext
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (89)
AspireEFMySqlExtensionsTests.cs (27)
41
builder.AddMySqlDbContext<
TestDbContext
>("mysql");
44
var
context = host.Services.GetRequiredService<
TestDbContext
>();
60
builder.AddMySqlDbContext<
TestDbContext
>("mysql", settings => settings.ConnectionString = ConnectionString);
63
var
context = host.Services.GetRequiredService<
TestDbContext
>();
82
builder.AddMySqlDbContext<
TestDbContext
>("mysql");
85
var
context = host.Services.GetRequiredService<
TestDbContext
>();
104
builder.AddMySqlDbContext<
TestDbContext
>("mysql", configureDbContextOptions: optionsBuilder =>
113
var
context = host.Services.GetRequiredService<
TestDbContext
>();
147
builder.AddMySqlDbContext<
TestDbContext
>("mysql", configureDbContextOptions: optionsBuilder =>
156
var
context = host.Services.GetRequiredService<
TestDbContext
>();
194
builder.AddMySqlDbContext<
TestDbContext
>("mysql", configureDbContextOptions: optionsBuilder =>
199
var
context = host.Services.GetRequiredService<
TestDbContext
>();
229
builder.AddMySqlDbContext<
TestDbContext
>("mysql", configureDbContextOptions: optionsBuilder =>
237
var
context = host.Services.GetRequiredService<
TestDbContext
>();
262
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseMySql(ConnectionString, s_serverVersion));
266
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseMySql(ConnectionString, s_serverVersion));
269
var exception = Assert.Throws<InvalidOperationException>(() => builder.AddMySqlDbContext<
TestDbContext
>("mysql"));
285
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseMySql(ConnectionString, s_serverVersion));
289
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseMySql(ConnectionString, s_serverVersion));
292
var exception = Record.Exception(() => builder.AddMySqlDbContext<
TestDbContext
>("mysql"));
ConformanceTests.cs (7)
17
public class ConformanceTests : ConformanceTests<
TestDbContext
, PomeloEntityFrameworkCoreMySqlSettings>, IClassFixture<MySqlContainerFixture>
91
=> builder.AddMySqlDbContext<
TestDbContext
>(key ?? "mysql", configure);
102
protected override void TriggerActivity(
TestDbContext
service)
116
IDbContextPool<
TestDbContext
>? pool = host.Services.GetService<IDbContextPool<
TestDbContext
>>();
125
TestDbContext
? dbContext = host.Services.GetService<
TestDbContext
>();
ConformanceTests_TypeSpecificConfig.cs (2)
19
new($"Aspire:Pomelo:EntityFrameworkCore:MySql:{typeof(
TestDbContext
).Name}:ConnectionString", ConnectionString),
20
new($"Aspire:Pomelo:EntityFrameworkCore:MySql:{typeof(
TestDbContext
).Name}:ServerVersion", ServerVersion)
EnrichMySqlTests.cs (50)
32
builder.Services.AddDbContextPool<
TestDbContext
>((serviceProvider, options) =>
42
builder.EnrichMySqlDbContext<
TestDbContext
>(configure);
50
var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichMySqlDbContext<
TestDbContext
>());
59
builder.Services.AddDbContext<
TestDbContext
>(options => options.UseMySql(ConnectionString, DefaultVersion));
61
builder.EnrichMySqlDbContext<
TestDbContext
>();
77
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
85
builder.EnrichMySqlDbContext<
TestDbContext
>();
88
var
context = host.Services.GetRequiredService<
TestDbContext
>();
112
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
120
builder.EnrichMySqlDbContext<
TestDbContext
>(settings => settings.CommandTimeout = 456);
123
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
132
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
137
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
140
builder.EnrichMySqlDbContext<
TestDbContext
>();
143
var
context = host.Services.GetRequiredService<
TestDbContext
>();
167
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
175
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
178
builder.EnrichMySqlDbContext<
TestDbContext
>();
181
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
186
var
context = host.Services.GetRequiredService<
TestDbContext
>();
210
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
218
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
221
builder.EnrichMySqlDbContext<
TestDbContext
>();
224
var
context = host.Services.GetRequiredService<
TestDbContext
>();
244
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(optionsBuilder =>
249
builder.EnrichMySqlDbContext<
TestDbContext
>();
252
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
261
builder.Services.AddDbContext<ITestDbContext,
TestDbContext
>(optionsBuilder =>
266
builder.EnrichMySqlDbContext<
TestDbContext
>();
268
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
273
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
282
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
287
builder.EnrichMySqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = true);
290
var
context = host.Services.GetRequiredService<
TestDbContext
>();
310
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
315
builder.EnrichMySqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
318
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
327
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
332
builder.EnrichMySqlDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
335
var
context = host.Services.GetRequiredService<
TestDbContext
>();
359
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
364
builder.EnrichMySqlDbContext<
TestDbContext
>();
tests\Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests\TestDbContext.cs (3)
10
public DbSet<
TestDbContext
.CatalogBrand> CatalogBrands { get; }
15
public TestDbContext(DbContextOptions<
TestDbContext
> options) : base(options)
20
public DbContextOptions<
TestDbContext
> Options { get; }