示例#1
0
        public void TestImmutableLongGauge()
        {
            const string name = "default";
            const string desc = "default";
            const long value = 3;
            var gauge = new ImmutableLongGauge(new MetricsInfoImpl(name, desc), value);
            Assert.Equal(value, gauge.LongValue);
            Assert.Null(gauge.NumericValue);
            Assert.Equal(MetricType.Gauge, gauge.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            gauge.Visit(visitor);
            Assert.Equal(value, visitor.LongGauge);
        }
示例#2
0
        public void TestImmutableCounter()
        {
            const string name = "default";
            const string desc = "default";
            const long value = 3;
            ImmutableCounter counter = new ImmutableCounter(new MetricsInfoImpl(name, desc), value);
            Assert.Equal(value, counter.LongValue);
            Assert.Null(counter.NumericValue);
            Assert.Equal(MetricType.Counter, counter.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            counter.Visit(visitor);
            Assert.Equal(value, visitor.CounterValue);
        }
        public void TestImmutableLongGauge()
        {
            const string name  = "default";
            const string desc  = "default";
            const long   value = 3;
            var          gauge = new ImmutableLongGauge(new MetricsInfoImpl(name, desc), value);

            Assert.Equal(value, gauge.LongValue);
            Assert.Null(gauge.NumericValue);
            Assert.Equal(MetricType.Gauge, gauge.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            gauge.Visit(visitor);
            Assert.Equal(value, visitor.LongGauge);
        }
        public void TestImmutableCounter()
        {
            const string     name    = "default";
            const string     desc    = "default";
            const long       value   = 3;
            ImmutableCounter counter = new ImmutableCounter(new MetricsInfoImpl(name, desc), value);

            Assert.Equal(value, counter.LongValue);
            Assert.Null(counter.NumericValue);
            Assert.Equal(MetricType.Counter, counter.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            counter.Visit(visitor);
            Assert.Equal(value, visitor.CounterValue);
        }
示例#5
0
        public void TestImmutableDoubleGauge()
        {
            const string name = "default";
            const string desc = "default";
            const double value = 4.3;
            var gauge = new ImmutableDoubleGauge(new MetricsInfoImpl(name, desc), value);
            Assert.NotNull(gauge.NumericValue);
            Assert.True(gauge.NumericValue.HasValue, "Numerical field should have value.");
            Assert.Equal(value, gauge.NumericValue.Value, 10);
            Assert.Null(gauge.LongValue);
            Assert.Equal(MetricType.Gauge, gauge.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            gauge.Visit(visitor);
            Assert.Equal(value, visitor.DoubleGauge, 10);
        }
        public void TestImmutableDoubleGauge()
        {
            const string name  = "default";
            const string desc  = "default";
            const double value = 4.3;
            var          gauge = new ImmutableDoubleGauge(new MetricsInfoImpl(name, desc), value);

            Assert.NotNull(gauge.NumericValue);
            Assert.True(gauge.NumericValue.HasValue, "Numerical field should have value.");
            Assert.Equal(value, gauge.NumericValue.Value, 10);
            Assert.Null(gauge.LongValue);
            Assert.Equal(MetricType.Gauge, gauge.TypeOfMetric);

            MetricTestUtils.MetricsVisitorForTests visitor = new MetricTestUtils.MetricsVisitorForTests();
            gauge.Visit(visitor);
            Assert.Equal(value, visitor.DoubleGauge, 10);
        }