public UpdateModifiersTests() { var admin = new MongoAdmin("mongodb://localhost/admin?pooling=false&strict=true"); _server = Mongo.Create("mongodb://localhost/NormTests?pooling=false&strict=true"); _collection = _server.GetCollection<Post>("Posts"); _buildInfo = admin.BuildInfo(); }
public void ReturnsBuildInfo() { string gitVersion; string version; using (var process = new Process()) { process.StartInfo = new ProcessStartInfo("mongod", "--version") { RedirectStandardOutput = true, UseShellExecute = false }; process.Start(); using (var stream = process.StandardOutput) { var data = stream.ReadToEnd(); gitVersion = Regex.Match(data, "git version: ([a-f0-9]+)\r\n").Groups[1].Value; version = Regex.Match(data, "db version v([^,]+),").Groups[1].Value; } } using (var admin = new MongoAdmin(TestHelper.ConnectionString(null, "admin", null, null))) { var info = admin.BuildInfo(); Assert.Equal(true, info.WasSuccessful); Assert.Equal(gitVersion, info.GitVersion); Assert.Equal(version, info.Version); } }
public void BuildInfoThrowsExceptionIfNotConnectedToAdmin() { using (var admin = new MongoAdmin(TestHelper.ConnectionString())) { var ex = Assert.Throws <MongoException>(() => admin.BuildInfo()); Assert.Equal("This command is only valid when connected to admin", ex.Message); } }
public void BuildInfoThrowsExceptionIfNotConnectedToAdmin() { using (var admin = new MongoAdmin(TestHelper.ConnectionString())) { var ex = Assert.Throws<MongoException>(() => admin.BuildInfo()); Assert.Equal("This command is only valid when connected to admin", ex.Message); } }
public UpdateModifiersTests() { var admin = new MongoAdmin("mongodb://localhost/admin?pooling=false&strict=true"); _server = Mongo.Create("mongodb://localhost/NormTests?pooling=false&strict=true"); _collection = _server.GetCollection <Post>("Posts"); _buildInfo = admin.BuildInfo(); }
public QueryTests() { var admin = new MongoAdmin("mongodb://localhost/admin?pooling=false&strict=true"); _server = Mongo.Create("mongodb://localhost/NormTests?pooling=false"); _collection = _server.GetCollection<Person>("People"); _buildInfo = admin.BuildInfo(); //cause the collection to exist on the server by inserting, then deleting some things. _collection.Insert(new Person()); _collection.Delete(new { }); }
public QueryTests() { var admin = new MongoAdmin("mongodb://localhost/admin?pooling=false&strict=true"); _server = Mongo.Create("mongodb://localhost/NormTests?pooling=false"); _collection = _server.GetCollection <Person>("People"); _buildInfo = admin.BuildInfo(); //cause the collection to exist on the server by inserting, then deleting some things. _collection.Insert(new Person()); _collection.Delete(new { }); }
public void ForceSyncDoesSomethingOk() { using (var admin = new MongoAdmin(TestHelper.ConnectionString(null, "admin", null, null))) { if (!admin.BuildInfo().SystemInformation.ToLower().Contains("windows")) { var response = admin.ForceSync(true); Assert.Equal(true, response.WasSuccessful); Assert.True(response.NumberOfFiles > 0); //don't know what this is } else { Assert.Throws(typeof(MongoException), () => admin.ForceSync(true)); Console.WriteLine("FSync is not supported on windows version of MongoDB and will throw an exception."); } } }
public void ForceSyncDoesSomethingOk() { using (var admin = new MongoAdmin(TestHelper.ConnectionString(null, "admin", null, null))) { if (!admin.BuildInfo().SystemInformation.ToLower().Contains("windows")) { var response = admin.ForceSync(true); Assert.Equal(1d, response.Ok); Assert.True(response.NumberOfFiles > 0); //don't know what this is } else { Assert.Throws(typeof(MongoException),()=> admin.ForceSync(true)); Console.WriteLine("FSync is not supported on windows version of MongoDB and will throw an exception."); } } }
public void ReturnsBuildInfo() { string gitVersion; string version; using (var process = new Process()) { process.StartInfo = new ProcessStartInfo("mongod", "--version"){ RedirectStandardOutput = true, UseShellExecute = false}; process.Start(); using (var stream = process.StandardOutput) { var data = stream.ReadToEnd(); gitVersion = Regex.Match(data, "git version: ([a-f0-9]+)\r\n").Groups[1].Value; version = Regex.Match(data, "db version v([^,]+),").Groups[1].Value; } } using (var admin = new MongoAdmin(TestHelper.ConnectionString(null, "admin", null, null))) { var info = admin.BuildInfo(); Assert.Equal(1d, info.Ok); Assert.Equal(gitVersion, info.GitVersion); Assert.Equal(version, info.Version); } }