using System; using Microsoft.Extensions.DependencyInjection; using Mongo2Go; using Volo.Abp.Data; using Volo.Abp.Modularity; using Volo.Abp.TestApp; using Volo.Abp.TestApp.Domain; using Volo.Abp.TestApp.MongoDB; namespace Volo.Abp.MongoDB { [DependsOn( typeof(AbpMongoDbModule), typeof(TestAppModule) )] public class AbpMongoDbTestModule : AbpModule { private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); public override void ConfigureServices(ServiceConfigurationContext context) { var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + "Db_" + Guid.NewGuid().ToString("N"); Configure(options => { options.ConnectionStrings.Default = connectionString; }); context.Services.AddMongoDbContext(options => { options.AddDefaultRepositories(); options.AddRepository(); }); } } }