public void StartAndStopLocalMongo() { var mongoProcessManager = new LocalMongoProcessManager(); mongoProcessManager.StartMongoProcess(); mongoProcessManager.IsMongoRunning().Should().Be(true); mongoProcessManager.KillAllMongoProcesses(); mongoProcessManager.IsMongoRunning().Should().Be(false); }
/// <summary> /// Fires up a local MongoDB instance and updates the connection information in the request to point to it. /// </summary> /// <returns>LocalMongoProcessManager object for a Mongod process in the Running state.</returns> public static LocalMongoProcessManager StartLocalMongoDbInstance(LogsharkRequest request) { var localMongoProcessManager = new LocalMongoProcessManager(request.LocalMongoPort); if (request.Configuration.LocalMongoOptions.PurgeLocalMongoOnStartup) { localMongoProcessManager.PurgeData(); } localMongoProcessManager.StartMongoProcess(); // Update MongoConnectionInfo on the request to point to the local instance. request.Configuration.MongoConnectionInfo = localMongoProcessManager.GetConnectionInfo(); return(localMongoProcessManager); }