public void FlushedMetricDoesNotHaveData()
        {
            var collector = new MetricsCollector();

            collector.Record("counter", 10M, Unit.Minute);

            collector.FlushToString();

            Assert.Equal(string.Empty, collector.GetMetrics()["counter"].FlushToString());
        }
        public void CollectorShouldIgnoreInvalidMetricNames()
        {
            var          collector   = new MetricsCollector();
            const string invalidName = "Invalid@Name";

            collector.IncrementCounter(invalidName, 1);
            using (collector.StartTimer(invalidName))
            {
                collector.Record(invalidName, 0, Unit.None);
            }

            Assert.Equal(string.Empty, collector.FlushToString());
        }
        public void MergeOfTwoCollectorsShouldWork()
        {
            var collector1 = new MetricsCollector();
            var collector2 = new MetricsCollector();

            collector1.IncrementCounter("Counter", 1);
            collector2.IncrementCounter("Counter", 10);

            collector1.Merge(collector2);
            var flushed = collector1.FlushToString();

            Assert.Equal("m.Counter=11", flushed);
        }