AspireMongoDBEntityFrameworkCoreExtensionsTests.cs (32)
35builder.AddMongoDbContext<TestDbContext>("mongodb", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
38var context = host.Services.GetRequiredService<TestDbContext>();
53builder.AddMongoDbContext<TestDbContext>("mongodb", databaseName: "explicitDb", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
56var context = host.Services.GetRequiredService<TestDbContext>();
71builder.AddMongoDbContext<TestDbContext>("mongodb", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
74var exception = Assert.Throws<InvalidOperationException>(host.Services.GetRequiredService<TestDbContext>);
88builder.AddMongoDbContext<TestDbContext>("mongodb","testdb", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
91var context = host.Services.GetRequiredService<TestDbContext>();
106builder.AddMongoDbContext<TestDbContext>("mongodb","testdb",
111var context = host.Services.GetRequiredService<TestDbContext>();
130builder.AddMongoDbContext<TestDbContext>("mongodb", "testdb", configureDbContextOptions: ConfigureDbContextOptionsBuilderForTesting);
133var context = host.Services.GetRequiredService<TestDbContext>();
151builder.AddMongoDbContext<TestDbContext>("mongodb","testdb", configureDbContextOptions: optionsBuilder =>
157var context = host.Services.GetRequiredService<TestDbContext>();
188builder.AddMongoDbContext<TestDbContext>("mongodb","testdb");
192var context = host.Services.GetRequiredService<TestDbContext>();
220builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName));
224builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName));
227var exception = Assert.Throws<InvalidOperationException>(() => builder.AddMongoDbContext<TestDbContext>("mongodb", "testdb"));
244builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName));
248builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName));
251var exception = Record.Exception(() => builder.AddMongoDbContext<TestDbContext>("mongodb", "testdb"));
272builder.AddMongoDbContext<TestDbContext>(connectionName, DatabaseName );
275builder.AddMongoDbContext<TestDbContext>(connectionName, databaseName, settings =>
302builder.AddMongoDbContext<TestDbContext>(connectionName, databaseName, settings =>