Esempio n. 1
0
        public void GetDatabaseName_DatabaseName_ReturnsDatabaseName()
        {
            var nodeName = "TestDb";

            var dbName = SimoHelper.GetDatabaseName(nodeName);

            Assert.AreEqual("TestDb", dbName);
        }
Esempio n. 2
0
        public void GetDatabaseName_FullCollectionName_ReturnsDatabaseName()
        {
            var nodeName = "TestDb.Persons";

            var dbName = SimoHelper.GetDatabaseName(nodeName);

            Assert.AreEqual("TestDb", dbName);
        }
Esempio n. 3
0
        protected override void OnRequestSent()
        {
            var dbName = SimoHelper.GetDatabaseName(FullCollectionName);
            var cmd    = new GetLastErrorCommand(Connection)
            {
                DatabaseName = dbName
            };

            cmd.Execute();

            if (cmd.Response.IsEmpty)
            {
                return;
            }

            var errMsg = MongoDbErrorMessage.FromDocument(cmd.Response.Documents[0]);

            if (errMsg == null)
            {
                return;
            }

            throw new SimoCommandException(ExceptionMessages.DatabaseCommand_CommandWasNotOk, errMsg);
        }