69 references to TestDbContext
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (69)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (36)
27builder.AddCosmosDbContext<TestDbContext>("cosmosConnection", "databaseName", configureDbContextOptions: optionsBuilder => 36var context = host.Services.GetRequiredService<TestDbContext>(); 68builder.AddCosmosDbContext<TestDbContext>("cosmosConnection", "databaseName", 73var context = host.Services.GetRequiredService<TestDbContext>(); 102builder.AddCosmosDbContext<TestDbContext>("cosmosConnection", "databaseName", 113var context = host.Services.GetRequiredService<TestDbContext>(); 140builder.AddCosmosDbContext<TestDbContext>("cosmos", "test"); 144var context = host.Services.GetRequiredService<TestDbContext>(); 166builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 170builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 173var exception = Assert.Throws<InvalidOperationException>(() => builder.AddCosmosDbContext<TestDbContext>("cosmos", "databaseName")); 189builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 193builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 196var exception = Record.Exception(() => builder.AddCosmosDbContext<TestDbContext>("cosmos", "databaseName")); 230builder.AddCosmosDbContext<TestDbContext>("cosmos", "databaseName"); 233var context = host.Services.GetRequiredService<TestDbContext>(); 249builder.AddCosmosDbContext<TestDbContext>("cosmos", 253var context = host.Services.GetRequiredService<TestDbContext>(); 273builder.AddCosmosDbContext<TestDbContext>("cosmos", databaseName); 276var context = host.Services.GetRequiredService<TestDbContext>(); 294builder.AddCosmosDbContext<TestDbContext>("cosmos", 298var context = host.Services.GetRequiredService<TestDbContext>(); 312var exception = Assert.Throws<InvalidOperationException>(() => builder.AddCosmosDbContext<TestDbContext>("cosmos")); 322builder.AddCosmosDbContext<TestDbContext>("cosmos", "testdb"); 325var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 338var exception = Assert.Throws<InvalidOperationException>(() => builder.AddCosmosDbContext<TestDbContext>("cosmos")); 368builder.AddCosmosDbContext<TestDbContext>(connectionName, databaseName, settings => 397builder.AddCosmosDbContext<TestDbContext>(connectionName, databaseName, settings =>
ConformanceTests.cs (7)
15public class ConformanceTests : ConformanceTests<TestDbContext, EntityFrameworkCoreCosmosSettings> 37=> builder.AddCosmosDbContext<TestDbContext>(key ?? "cosmosdb", "TestDatabase", configure); 70protected override void TriggerActivity(TestDbContext service) 84IDbContextPool<TestDbContext>? pool = host.Services.GetService<IDbContextPool<TestDbContext>>(); 94TestDbContext? dbContext = host.Services.GetService<TestDbContext>();
EnrichCosmosDbTests.cs (23)
22builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 23builder.EnrichCosmosDbContext<TestDbContext>(configure); 31var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichCosmosDbContext<TestDbContext>()); 40builder.Services.AddDbContext<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 42builder.EnrichCosmosDbContext<TestDbContext>(); 55builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 64builder.EnrichCosmosDbContext<TestDbContext>(); 67var context = host.Services.GetRequiredService<TestDbContext>(); 88builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 93builder.EnrichCosmosDbContext<TestDbContext>(); 96var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 105builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 110builder.EnrichCosmosDbContext<TestDbContext>(); 112var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 117var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 126builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 131builder.EnrichCosmosDbContext<TestDbContext>(settings => settings.RequestTimeout = TimeSpan.FromSeconds(456)); 134var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 147builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 152builder.EnrichCosmosDbContext<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; }