public void TestExecuteUsing() { String tempcollname = null; using (MapReduceBuilder mrb = mrcol.MapReduceBuilder().Map(mapfunction).Reduce(reducefunction)){ MapReduce mr = mrb.Execute(); Assert.IsNotNull(mr.Result); Assert.IsTrue(mr.Result.Ok); tempcollname = tests.Name + "." + mr.Result.CollectionName; bool found = false; Assert.IsTrue(tests.GetCollectionNames().Contains(tempcollname)); } Assert.IsFalse(tests.GetCollectionNames().Contains(tempcollname)); }
public void TestCreateCollectionNoOptions() { Database tests = db["tests"]; tests.MetaData.CreateCollection("creatednoopts"); List <String> names = tests.GetCollectionNames(); Assert.IsTrue(names.Contains("tests.creatednoopts")); }
public void TestDropCollection() { Database tests = db["tests"]; bool dropped = tests.MetaData.DropCollection("todrop"); Assert.IsTrue(dropped, "Dropped was false"); List <String> names = tests.GetCollectionNames(); Assert.IsFalse(names.Contains("tests.todrop")); }
public void TestCreateCollectionWithInvalidOptions() { Database tests = db["tests"]; Document options = new Document().Append("invalidoption", true); tests.MetaData.CreateCollection("createdinvalid", options); List <String> names = tests.GetCollectionNames(); Assert.IsTrue(names.Contains("tests.createdinvalid")); }
public void TestDropInvalidCollection() { Database tests = db["tests"]; bool thrown = false; try{ tests.MetaData.DropCollection("todrop_notexists"); }catch (MongoCommandException) { thrown = true; } Assert.IsTrue(thrown, "Command exception should have been thrown"); List <String> names = tests.GetCollectionNames(); Assert.IsFalse(names.Contains("tests.todrop_notexists")); }