public void Can_remove_formatter_by_type()
        {
            // Arrange
            var formatters = new MetricsFormatterCollection();

            formatters.TryAdd(new MetricsJsonOutputFormatter());
            formatters.TryAdd(new MetricsTextOutputFormatter());

            // Act
            formatters.RemoveType <MetricsTextOutputFormatter>();

            // Assert
            formatters.Single().Should().BeOfType(typeof(MetricsJsonOutputFormatter));
        }
        public void Can_remove_formatter_by_media_type()
        {
            // Arrange
            var formatters = new MetricsFormatterCollection();

            formatters.TryAdd(new MetricsJsonOutputFormatter());
            formatters.TryAdd(new MetricsTextOutputFormatter());
            var mediaType = new MetricsMediaTypeValue("application", "vnd.appmetrics.metrics", "v1", "json");

            // Act
            formatters.RemoveType(mediaType);

            // Assert
            formatters.Single().Should().BeOfType(typeof(MetricsTextOutputFormatter));
        }
        public void Should_remove_formatter_of_existing_type_when_adding()
        {
            // Arrange
            var formatters        = new MetricsFormatterCollection();
            var existingFormatter = new MetricsJsonOutputFormatter();

            formatters.TryAdd(existingFormatter);
            formatters.TryAdd(new MetricsTextOutputFormatter());

            // Act
            var newFormatter = new MetricsJsonOutputFormatter();

            formatters.TryAdd(newFormatter);

            // Assert
            formatters.Single(f => f.GetType() == typeof(MetricsJsonOutputFormatter)).Should().NotBeSameAs(existingFormatter);
        }