Example #1
0
        public void RespectNewDriverOverride()
        {
            var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetCollectionString());

            this.TestObject.OverrideMongoDBDriver(mongoDriver);

            Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection);
        }
Example #2
0
        public void RespectDirectDriverOverride()
        {
            var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetCollectionString());

            this.MongoDBDriver = mongoDriver;

            Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection);
        }
Example #3
0
        public void RespectCollectionDriverOverride()
        {
            //MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), collectionString
            var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetCollectionString());

            this.TestObject.MongoDBManager.OverrideDriver(mongoDriver);

            Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection);
        }
Example #4
0
        public void CanUseMultipleWithFunc()
        {
            var newCollection = MongoFactory.GetCollection <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString());

            MongoDriverManager <BsonDocument> newDriver = new MongoDriverManager <BsonDocument>(() => newCollection, this.TestObject);

            this.ManagerStore.Add("test", newDriver);

            Assert.AreNotEqual(this.TestObject.MongoDBDriver, (MongoDriverManager <BsonDocument>) this.ManagerStore["test"]);
            Assert.AreNotEqual(this.TestObject.MongoDBManager.Get(), ((MongoDriverManager <BsonDocument>) this.ManagerStore["test"]).Get());
            Assert.AreEqual(newCollection, ((MongoDriverManager <BsonDocument>) this.ManagerStore["test"]).GetMongoDriver().Collection);
        }
Example #5
0
        public void CanUseMultiple()
        {
            MongoDriverManager <BsonDocument> newManger = new MongoDriverManager <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString(), this.TestObject);

            this.ManagerStore.Add("test", newManger);

            Assert.AreNotEqual(this.TestObject.MongoDBDriver, (MongoDriverManager <BsonDocument>) this.ManagerStore["test"]);
            Assert.AreNotEqual(this.TestObject.MongoDBManager.Get(), ((MongoDriverManager <BsonDocument>) this.ManagerStore["test"]).Get());
            Assert.AreEqual(newManger.GetMongoDriver(), ((MongoDriverManager <BsonDocument>) this.ManagerStore["test"]).GetMongoDriver());
        }
Example #6
0
        public void OverrideWithCustomDriver()
        {
            var firstDriver = this.MongoDBDriver;
            var newDriver   = new MongoDBDriver <BsonDocument>(MongoFactory.GetCollection <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), null, MongoDBConfig.GetCollectionString()));

            this.TestObject.OverrideMongoDBDriver(newDriver);

            Assert.AreNotEqual(firstDriver, this.MongoDBDriver);
            Assert.AreEqual(newDriver, this.MongoDBDriver);
            Assert.IsFalse(this.MongoDBDriver.IsCollectionEmpty());
        }
Example #7
0
        public void OverrideConnectionStrings()
        {
            var collection = this.MongoDBDriver.Collection;

            this.TestObject.OverrideMongoDBDriver(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString());

            Assert.AreNotEqual(collection, this.MongoDBDriver.Collection);
            Assert.IsFalse(this.MongoDBDriver.IsCollectionEmpty());
        }
Example #8
0
 public void ConnectionConstuctor()
 {
     this.MongoDBDriver = new EventFiringMongoDBDriver <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString());
     Assert.IsNotNull(this.MongoDBDriver);
 }
Example #9
0
        public void RespectConnectionStingsOverrideInBase()
        {
            var collection = this.MongoDBDriver.Collection;

            this.OverrideConnectionDriver(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString());

            Assert.AreNotEqual(collection, this.MongoDBDriver.Collection);
        }