From 0d8ddfa1ffa6ab53b5009c595d5eda54d67fc7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 15 Aug 2019 11:33:20 +0300 Subject: [PATCH] Update BookStoreMongoDbTestModule.cs --- .../MongoDb/BookStoreMongoDbTestModule.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.MongoDB.Tests/MongoDb/BookStoreMongoDbTestModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.MongoDB.Tests/MongoDb/BookStoreMongoDbTestModule.cs index c59bf2452c..d45f3ea02f 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.MongoDB.Tests/MongoDb/BookStoreMongoDbTestModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.MongoDB.Tests/MongoDb/BookStoreMongoDbTestModule.cs @@ -1,6 +1,5 @@ using System; using Mongo2Go; -using Volo.Abp; using Volo.Abp.Data; using Volo.Abp.Modularity; @@ -12,21 +11,18 @@ namespace Acme.BookStore.MongoDB )] public class BookStoreMongoDbTestModule : AbpModule { - private MongoDbRunner _mongoDbRunner; + private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); public override void ConfigureServices(ServiceConfigurationContext context) { - _mongoDbRunner = MongoDbRunner.Start(); + var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + + "BookStore_" + + Guid.NewGuid().ToString("N"); Configure(options => { - options.ConnectionStrings.Default = _mongoDbRunner.ConnectionString.EnsureEndsWith('/') + "BookStore"; + options.ConnectionStrings.Default = connectionString; }); } - - public override void OnApplicationShutdown(ApplicationShutdownContext context) - { - _mongoDbRunner.Dispose(); - } } } \ No newline at end of file