GetCollectionNames() публичный Метод

public GetCollectionNames ( ) : List
Результат List
        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));
        }
Пример #2
0
        public void TestCreateCollectionNoOptions()
        {
            Database tests = db["tests"];

            tests.MetaData.CreateCollection("creatednoopts");

            List <String> names = tests.GetCollectionNames();

            Assert.IsTrue(names.Contains("tests.creatednoopts"));
        }
Пример #3
0
        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"));
        }
Пример #4
0
        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"));
        }
Пример #5
0
        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"));
        }