[modules/backgroundjobs] fix mongo.exe dispose

pull/2414/head
Mehmet Tüken 6 years ago
parent 1645483bd0
commit 734059d9ff

@ -1,6 +1,4 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Mongo2Go;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
@ -12,11 +10,9 @@ namespace Volo.Abp.BackgroundJobs.MongoDB
)]
public class AbpBackgroundJobsMongoDbTestModule : 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");

@ -1,5 +1,8 @@
namespace Volo.Abp.BackgroundJobs.MongoDB
using Xunit;
namespace Volo.Abp.BackgroundJobs.MongoDB
{
[Collection((MongoTestCollection.Name))]
public class BackgroundJobRepositoryTests : BackgroundJobRepository_Tests<AbpBackgroundJobsMongoDbTestModule>
{

@ -0,0 +1,16 @@
using System;
using Mongo2Go;
namespace Volo.Abp.BackgroundJobs.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.Abp.BackgroundJobs.MongoDB
{
[CollectionDefinition(Name)]
public class MongoTestCollection : ICollectionFixture<MongoDbFixture>
{
public const string Name = "MongoDB Collection";
}
}
Loading…
Cancel
Save