private void PrintMongoVersion(MongoContainer mongo) { var mongoClient = new MongoClient(mongo.GetConnectionString()); var clusterDescription = mongoClient.Cluster.Description; _testOutput.WriteLine($"Mongo version: {clusterDescription.Servers.First().Version}"); }
protected override async Task OnInitialized(MongoContainer mongoContainer) { await base.OnInitialized(mongoContainer); var client = new MongoClient(mongoContainer.GetConnectionString()); await client.GetDatabase("Forecast").GetCollection <WeatherForecast>("WeatherForecast").InsertManyAsync(new[] { new WeatherForecast { Date = DateTime.Today.ToUniversalTime(), Summary = "Good weather", TemperatureC = 7 }, new WeatherForecast { Date = DateTime.Today.AddDays(-1).ToUniversalTime(), Summary = "Usual weather", TemperatureC = 3 }, new WeatherForecast { Date = DateTime.Today.AddDays(-2).ToUniversalTime(), Summary = "Bad weather", TemperatureC = 0 } }); }