[modules/docs] fix mongo.exe dispose

pull/2414/head
Mehmet Tüken 5 years ago
parent 4adaf68123
commit 8bf5a24fbc

@ -1,6 +1,4 @@
using System;
using Mongo2Go;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
@ -12,11 +10,9 @@ namespace Volo.Docs.MongoDB
)]
public class DocsMongoDBTestModule : AbpModule
{
private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start();
public override void ConfigureServices(ServiceConfigurationContext context)
{
var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') +
var connectionString = MongoDbFixture.ConnectionString.EnsureEndsWith('/') +
"Db_" +
Guid.NewGuid().ToString("N");

@ -0,0 +1,16 @@
using System;
using Mongo2Go;
namespace Volo.Docs.MongoDB
{
public class MongoDbFixture : IDisposable
{
private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start();
public static readonly string ConnectionString = MongoDbRunner.ConnectionString;
public void Dispose()
{
MongoDbRunner?.Dispose();
}
}
}

@ -0,0 +1,10 @@
using Xunit;
namespace Volo.Docs.MongoDB
{
[CollectionDefinition(Name)]
public class MongoTestCollection : ICollectionFixture<MongoDbFixture>
{
public const string Name = "MongoDB Collection";
}
}

@ -1,7 +1,9 @@
using Volo.Docs.MongoDB;
using Xunit;
namespace Volo.Docs.Project
{
[Collection(MongoTestCollection.Name)]
public class ProjectRepository_Tests : ProjectRepository_Tests<DocsMongoDBTestModule>
{
}

Loading…
Cancel
Save