public void Should_create_background_client_from_uri() { var uri = "udp://localhost:8181?prefix=test"; var actual = BuildStatsd.From(uri); actual.Should().BeOfType <BackgroundStatsdClient>(); }
/// <summary> /// Configures the property <see cref="Client"/> with appropriate implementation of <see cref="IStatsdClient"/> /// <remarks>Do not use synchronous <see cref="IStatsdClient"/> to avoid threading issues.</remarks> /// <remarks>Default values for parameters: prefix=null, background=true, ignore_exceptions=true</remarks> /// <code> /// // the following strings are equivalent /// var uri = "udp://host:port?prefix=my_prefix&background&ignore_exceptions" /// var uri = "udp://host:port?prefix=my_prefix&background=true&ignore_exceptions=true" /// </code> /// /// </summary> /// <param name="uri">Parameter of the statsd client </param> /// <param name="exceptionHandler">Action to perform on an unhandled exception. Most commoly it's used for logging</param> public static void Configure(Uri uri, Action <Exception> exceptionHandler = null) { _statsdClient = BuildStatsd.From(uri, exceptionHandler); }