[modules/identity] fix mongo.exe dispose

pull/2414/head
Mehmet Tüken 5 years ago
parent 993d5c5a09
commit 96f7b57ab7

@ -1,6 +1,4 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Mongo2Go;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.MongoDB;
@ -14,11 +12,9 @@ namespace Volo.Abp.Identity.MongoDB
)]
public class AbpIdentityMongoDbTestModule : 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.Identity.MongoDB
using Xunit;
namespace Volo.Abp.Identity.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class IdentityClaimTypeRepository_Tests : IdentityClaimTypeRepository_Tests<AbpIdentityMongoDbTestModule>
{

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

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

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

@ -1,5 +1,8 @@
namespace Volo.Abp.Identity.MongoDB
using Xunit;
namespace Volo.Abp.Identity.MongoDB
{
[Collection(MongoTestCollection.Name)]
public class Identity_Repository_Resolve_Tests : Identity_Repository_Resolve_Tests<AbpIdentityMongoDbTestModule>
{
}

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