Exemplo n.º 1
0
        public void CreateDB_1()//Verifies a DB created and exists
        {
            appConnection.ConnectServer("mongodb://127.0.0.1:27017", null);
            string newDbName     = "stasdb55";
            string newcollection = "StasUnitTCreateColl5";

            UnitTest1 existingdbname = new UnitTest1();
            var       result         = existingdbname.DatabaseExists(newDbName);

            if (result == true)// DB already exists check
            {
                Fail("DB already exists");
            }
            else
            {
                CreateDB create = new CreateDB();
                create.CreateDBs(newDbName, newcollection, appConnection, "Field", "Value");
                var result1 = existingdbname.DatabaseExists(newDbName);

                Assert.True(result1);//Checks true/false saved in "result"
            }
        }
Exemplo n.º 2
0
        public void CreateCollection_2()//Verifies a collection created in specific db
        {
            string newDbName1     = "stasdb55";
            string newcollection1 = "StasUnitTCreateColl6";

            appConnection.ConnectServer("mongodb://127.0.0.1:27017", null);

            UnitTest1 existingcollname = new UnitTest1();
            var       result           = existingcollname.CollectionExists(newcollection1);

            if (result == true)// Collection already exists check
            {
                Fail("The Collectionn already exists");
            }
            else
            {
                CreateDB create = new CreateDB();
                create.CreateDBs(newDbName1, newcollection1, appConnection, "Field", "Value");
                var result1 = existingcollname.DatabaseExists(newDbName1);

                Assert.True(result1);//Checks true/false saved in "result"
            }
        }