public void Is_Connected_Returns_Up_Status() { var mongoDbConfig = new MongoDbConnectorOptions(); var sInfo = new MongoDbServiceInfo("MyId", "mongodb://localhost:27017"); var logrFactory = new LoggerFactory(); var connFactory = new MongoDbConnectorFactory(sInfo, mongoDbConfig, mongoDbImplementationType); var h = new MongoDbHealthContributor(connFactory, logrFactory.CreateLogger <MongoDbHealthContributor>()); var status = h.Health(); Assert.Equal(HealthStatus.UP, status.Status); }
public void Not_Connected_Returns_Down_Status() { var mongoDbConfig = new MongoDbConnectorOptions(); var sInfo = new MongoDbServiceInfo("MyId", "mongodb://localhost:27018"); var logrFactory = new LoggerFactory(); var connFactory = new MongoDbConnectorFactory(sInfo, mongoDbConfig, mongoDbImplementationType); var h = new MongoDbHealthContributor(connFactory, logrFactory.CreateLogger <MongoDbHealthContributor>(), 1); var status = h.Health(); Assert.Equal(HealthStatus.DOWN, status.Status); Assert.Equal("Failed to open MongoDb connection!", status.Description); }