// Insert a document in database named "testdb", in a collection named "testcollection"
        //The document to be inserted should have a property named "Name" and it's value should be "MyName"
        public void MongoCrud_01_InsertOne_Document()
        {
            var objectId = ObjectId.GenerateNewId().ToString();

            InsertOne(objectId);
            MongoOperationsVerifier.VerifyInsertOne(_runner.ConnectionString, objectId);
        }
        // Insert a list of documenst in database named "testdb", in a collection named "testcollection"
        // find a document with name "MyName0" and updated it to "UpdatedName"
        // support for three type of operation FindOneAndUpdate, FindOneAndReplace, FindOneAndDelete
        // Returns the document before or after operation

        public void MongoCrud_07_1_FindAndDoOperation_Update_MyName0_UpdatedName()
        {
            #region mongoConnection

            mongoCollection = new MongoClient(_runner.ConnectionString).GetDatabase("testdb").GetCollection <Test>("testcollection");

            #endregion
            #region data preparation
            var documents = InsertMany();
            #endregion

            var filterDefinitionBuilder = Builders <Test> .Filter;
            var filter          = filterDefinitionBuilder.Eq(x => x.Name, "MyName0");
            var updateOperation = Builders <Test> .Update.Set(x => x.Name, "UpdatedName");

            var options = new FindOneAndUpdateOptions <Test>
            {
                ReturnDocument = ReturnDocument.After
            };
            var document = mongoCollection.FindOneAndUpdate(filter, updateOperation, options);

            #region verification
            MongoOperationsVerifier.VerifyFindOneAndUpdate(_runner.ConnectionString, document);

            #endregion
        }
        public void MongoCrud_03_1_Find_All_Document()
        {
            //Insert 10 documents with name as Myname + i \\\
            var documents = InsertMany();

            var filterFindAll = Builders <Test> .Filter.Empty;
            var dbDocuments   = mongoCollection.Find(filterFindAll).ToList();

            MongoOperationsVerifier.VerifyFindAll(dbDocuments);
        }
        public void MongoCrud_03_2_Find_DocumentBy_Name()
        {
            //Insert 10 documents with name as Myname + i \\\
            var documents = InsertMany();

            var filterFindOne = Builders <Test> .Filter.Eq(x => x.Name, "MyName0");

            var dbDocument = mongoCollection.Find(filterFindOne).FirstOrDefault();

            MongoOperationsVerifier.VerifyFindMyName0(dbDocument);
        }
        // Insert a list of documenst in database named "testdb", in a collection named "testcollection"
        // delete the document with name "MyName0"

        public void MongoCrud_06_1_DeleteOne_DocumentWithName_MyName0()
        {
            #region mongoConnection

            mongoCollection = new MongoClient(_runner.ConnectionString).GetDatabase("testdb").GetCollection <Test>("testcollection");

            #endregion
            #region data preparation
            var documents = InsertMany();
            #endregion
            var beforeUpdate = mongoCollection.Find(Builders <Test> .Filter.Empty).ToList();
            var filter       = new BsonDocument(new BsonDocument("Name", "MyName0"));
            var filter1      = Builders <Test> .Filter.Eq(x => x.Name, "MyNAme");

            mongoCollection.DeleteMany(filter);

            #region verification
            MongoOperationsVerifier.VerifyDeleteOne(_runner.ConnectionString, documents);

            #endregion
        }
        // Insert a list of documenst in database named "testdb", in a collection named "testcollection"
        // update the column Name with value "MyName1" to "UpdatedName"
        // although multiple documents match only first document will be updated

        public void MongoCrud_04_1_UpdateOne_SetDocumentWithName_MyName1_To_UpdatedName()
        {
            #region mongoConnection

            mongoCollection = new MongoClient(_runner.ConnectionString).GetDatabase("testdb").GetCollection <Test>("testcollection");

            #endregion
            #region data preparation
            var documents = InsertMany();
            #endregion

            var beforeUpdate = mongoCollection.Find(Builders <Test> .Filter.Empty).ToList();
            var filter       = Builders <Test> .Filter.Eq(x => x.Name, "MyName1");

            var updateOperation = Builders <Test> .Update.Set(x => x.Name, "UpdatedName");

            mongoCollection.UpdateOne(filter, updateOperation);

            #region verification
            MongoOperationsVerifier.VerifyUpdateOne(_runner.ConnectionString, documents);
            #endregion
        }
        // Insert a list of 10 documents in database named "testdb", in a collection named "testcollection"
        //The document to be inserted should be of type Test Class
        public void MongoCrud_02_InsertMany_Document()
        {
            List <Test> documents = InsertMany();

            MongoOperationsVerifier.VerifyInsertMany(_runner.ConnectionString, documents);
        }