public void Database_selector_is_used_to_select_database() { const string expectedDatabase = "expectedDatabase"; const string incorrectDatabase = "databaseName"; var options = new InfluxDbObserverOptions(incorrectDatabase) { DatabaseSelector = _ => expectedDatabase }; var observer = new InfluxDbObserver(new MetricMonitorRegistryPoller(DefaultMonitorRegistry.Instance), influxDbClient, options); observer.Update(new[] { new Metric("name", DateTimeOffset.UtcNow, new Tag[0], 0, new Metric[0]) }); influxDbClient.DidNotReceive().WriteAsync(Arg.Any <string>(), incorrectDatabase, Arg.Any <IEnumerable <Point> >()); influxDbClient.Received(1).WriteAsync(Arg.Any <string>(), expectedDatabase, Arg.Is <IEnumerable <Point> >(x => x.All(y => y.Measurement == "name"))); }