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