public void GetDatabaseConnectionStringTest() { #region GetConnection string connection = MongoDBConfig.GetConnectionString(); #endregion Assert.AreEqual("mongodb://localhost:27017", connection); }
public void RespectConnectionStingsOverrideInBase() { var collection = this.MongoDBDriver.Collection; this.OverrideConnectionDriver(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString()); Assert.AreNotEqual(collection, this.MongoDBDriver.Collection); }
public void RespectDriverConnectionsOverride() { var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString()); this.TestObject.MongoDBManager.OverrideDriver(mongoDriver); Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection); }
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()); }
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); }
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()); }
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()); }
public void ConnectionConstuctor() { this.MongoDBDriver = new EventFiringMongoDBDriver <BsonDocument>(MongoDBConfig.GetConnectionString(), MongoDBConfig.GetDatabaseString(), MongoDBConfig.GetCollectionString()); Assert.IsNotNull(this.MongoDBDriver); }