Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
841 B

using System;
using Mongo2Go;
using MongoDB.Driver;
using Volo.Abp.MongoDB;
namespace Volo.CmsKit.MongoDB
{
public class MongoDbFixture : IDisposable
{
private static readonly MongoDbRunner MongoDbRunner;
public static readonly string ConnectionString;
static MongoDbFixture()
{
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 10);
ConnectionString = MongoDbRunner.ConnectionString;
//TODO It can be removed, when Mongo2Go solves this issue : https://github.com/Mongo2Go/Mongo2Go/issues/89
var client = new MongoClient(MongoDbRunner.ConnectionString);
client.EnsureReplicationSetReady();
}
public void Dispose()
{
MongoDbRunner?.Dispose();
}
}
}