Browse Source

[modules/featuremanagement] fix mongo.exe dispose

pull/2414/head
Mehmet Tüken 7 years ago
parent
commit
993d5c5a09
  1. 5
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/AbpFeatureManagementMongoDbTestModule.cs
  2. 5
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementStore_Tests.cs
  3. 5
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/FeatureValueRepositoryTests.cs
  4. 16
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoDbFixture.cs
  5. 10
      modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoTestCollection.cs

5
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/AbpFeatureManagementMongoDbTestModule.cs

@ -1,5 +1,4 @@
using System;
using Mongo2Go;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
@ -11,11 +10,9 @@ namespace Volo.Abp.FeatureManagement.MongoDB
)]
public class AbpFeatureManagementMongoDbTestModule : 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");

5
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementStore_Tests.cs

@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class FeatureManagementStore_Tests : FeatureManagementStore_Tests<AbpFeatureManagementMongoDbTestModule>
{

5
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/FeatureValueRepositoryTests.cs

@ -1,5 +1,8 @@
namespace Volo.Abp.FeatureManagement.MongoDB
using Xunit;
namespace Volo.Abp.FeatureManagement.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class FeatureValueRepositoryTests : FeatureValueRepository_Tests<AbpFeatureManagementMongoDbTestModule>
{

16
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoDbFixture.cs

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

10
modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo/Abp/FeatureManagement/MongoDB/MongoTestCollection.cs

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