89 references to TestDbContext
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (89)
AspireSqlServerEFCoreSqlClientExtensionsTests.cs (30)
28
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection");
31
var
context = host.Services.GetRequiredService<
TestDbContext
>();
44
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection", settings => settings.ConnectionString = ConnectionString);
47
var
context = host.Services.GetRequiredService<
TestDbContext
>();
64
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection");
67
var
context = host.Services.GetRequiredService<
TestDbContext
>();
85
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection", configureDbContextOptions: optionsBuilder =>
94
var
context = host.Services.GetRequiredService<
TestDbContext
>();
129
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection", configureDbContextOptions: optionsBuilder =>
138
var
context = host.Services.GetRequiredService<
TestDbContext
>();
174
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection",
179
var
context = host.Services.GetRequiredService<
TestDbContext
>();
208
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection",
214
var
context = host.Services.GetRequiredService<
TestDbContext
>();
241
builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection");
245
var
context = host.Services.GetRequiredService<
TestDbContext
>();
267
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
271
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
274
var exception = Assert.Throws<InvalidOperationException>(() => builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection"));
290
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
294
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
297
var exception = Record.Exception(() => builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection"));
ConformanceTests.cs (7)
16
public class ConformanceTests : ConformanceTests<
TestDbContext
, MicrosoftEntityFrameworkCoreSqlServerSettings>, IClassFixture<SqlServerContainerFixture>
80
=> builder.AddSqlServerDbContext<
TestDbContext
>("sqlconnection", configure);
91
protected override void TriggerActivity(
TestDbContext
service)
102
IDbContextPool<
TestDbContext
>? pool = host.Services.GetService<IDbContextPool<
TestDbContext
>>();
112
TestDbContext
? dbContext = host.Services.GetService<
TestDbContext
>();
ConformanceTests_TypeSpecificConfig.cs (1)
20
new($"Aspire:Microsoft:EntityFrameworkCore:SqlServer:{typeof(
TestDbContext
).Name}:ConnectionString", ConnectionString)
EnrichSqlServerTests.cs (48)
27
builder.Services.AddDbContextPool<
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
28
builder.EnrichSqlServerDbContext<
TestDbContext
>(configure);
36
var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichSqlServerDbContext<
TestDbContext
>());
45
builder.Services.AddDbContext<
TestDbContext
>(options => options.UseSqlServer(ConnectionString));
47
builder.EnrichSqlServerDbContext<
TestDbContext
>();
63
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
71
builder.EnrichSqlServerDbContext<
TestDbContext
>();
74
var
context = host.Services.GetRequiredService<
TestDbContext
>();
98
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
106
builder.EnrichSqlServerDbContext<
TestDbContext
>(settings => settings.CommandTimeout = 456);
109
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
118
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
123
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
126
builder.EnrichSqlServerDbContext<
TestDbContext
>();
129
var
context = host.Services.GetRequiredService<
TestDbContext
>();
153
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
161
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
164
builder.EnrichSqlServerDbContext<
TestDbContext
>();
167
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
172
var
context = host.Services.GetRequiredService<
TestDbContext
>();
196
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
204
var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
207
builder.EnrichSqlServerDbContext<
TestDbContext
>();
210
var
context = host.Services.GetRequiredService<
TestDbContext
>();
230
builder.Services.AddDbContextPool<ITestDbContext,
TestDbContext
>(optionsBuilder =>
235
builder.EnrichSqlServerDbContext<
TestDbContext
>();
238
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
247
builder.Services.AddDbContext<ITestDbContext,
TestDbContext
>(optionsBuilder =>
252
builder.EnrichSqlServerDbContext<
TestDbContext
>();
254
var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<
TestDbContext
>));
259
var
context = host.Services.GetRequiredService<ITestDbContext>() as
TestDbContext
;
268
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
273
builder.EnrichSqlServerDbContext<
TestDbContext
>(settings => settings.DisableRetry = true);
276
var
context = host.Services.GetRequiredService<
TestDbContext
>();
296
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
301
builder.EnrichSqlServerDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
304
var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<
TestDbContext
>);
313
builder.Services.AddDbContextPool<
TestDbContext
>(optionsBuilder =>
318
builder.EnrichSqlServerDbContext<
TestDbContext
>(settings => settings.DisableRetry = false);
321
var
context = host.Services.GetRequiredService<
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; }