public void CanOverrideMongoDriver() { MongoDBDriver <BsonDocument> tempDriver = new MongoDBDriver <BsonDocument>(); this.MongoDBDriver = tempDriver; Assert.AreEqual(this.TestObject.MongoDBManager.Get(), tempDriver); }
public void RespectNewDriverOverride() { var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetCollectionString()); this.TestObject.OverrideMongoDBDriver(mongoDriver); Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection); }
public void RespectDirectDriverOverride() { var mongoDriver = new MongoDBDriver <BsonDocument>(MongoDBConfig.GetCollectionString()); this.MongoDBDriver = mongoDriver; Assert.AreEqual(mongoDriver.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 RespectDefaultDriverOverride() { var mongoDriver = new MongoDBDriver <BsonDocument>(); this.TestObject.MongoDBManager.OverrideDriver(mongoDriver); Assert.AreEqual(mongoDriver.Collection, this.MongoDBDriver.Collection); Assert.AreEqual(mongoDriver.Collection.Database, this.MongoDBDriver.Database); Assert.AreEqual(mongoDriver.Collection.Database.Client, this.MongoDBDriver.Client); }
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 OverrideDriver() { var firstDriver = this.MongoDBDriver; var newDriver = new MongoDBDriver <BsonDocument>(MongoFactory.GetDefaultCollection <BsonDocument>()); this.TestObject.OverrideMongoDBDriver(newDriver); Assert.AreNotEqual(firstDriver, this.MongoDBDriver); Assert.AreEqual(newDriver, this.MongoDBDriver); Assert.IsFalse(this.MongoDBDriver.IsCollectionEmpty()); }
public TestMongoDB() { Car car = new Car { veichle = "Fiesta", vendor = "Ford", year = 2008, description = "Ford Fiesta 2008 1.6", sold = false, createdAt = DateTime.Now, updatedAt = DateTime.Now }; MongoDBDriver db = new MongoDBDriver(); db.OperateCar(ref car, DaoOperations.Insert); List <Car> result = (List <Car>)(db.OperateCar(ref car, DaoOperations.Search).data); bool ok = result.Count > 0; string a = ok.ToString(); ok = bool.Parse(a); }