51 references to TestDbContext
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (51)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (18)
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"));
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)
23builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 24builder.EnrichCosmosDbContext<TestDbContext>(configure); 32var exception = Assert.Throws<InvalidOperationException>(() => builder.EnrichCosmosDbContext<TestDbContext>()); 41builder.Services.AddDbContext<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 43builder.EnrichCosmosDbContext<TestDbContext>(); 56builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 65builder.EnrichCosmosDbContext<TestDbContext>(); 68var context = host.Services.GetRequiredService<TestDbContext>(); 89builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 94builder.EnrichCosmosDbContext<TestDbContext>(); 97var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 106builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 111builder.EnrichCosmosDbContext<TestDbContext>(); 113var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 118var context = host.Services.GetRequiredService<ITestDbContext>() as TestDbContext; 127builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 132builder.EnrichCosmosDbContext<TestDbContext>(settings => settings.RequestTimeout = TimeSpan.FromSeconds(456)); 135var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>); 148builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 153builder.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; }