コード例 #1
0
        public void GetConfiguration()
        {
            TelemetryConfiguration pipeline = Util.CreateAITelemetryConfig();
            TelemetryClient        client   = new TelemetryClient(pipeline);

            {
                Metric metric = client.GetMetric("CowsSold");
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("PigsSold", MetricConfigurations.Accumulator);
                Assert.AreEqual(MetricConfigurations.Accumulator, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator, metric.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("HorsesSold", MetricConfigurations.Measurement);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());
            }
            {
                IMetricConfiguration config = new SimpleMetricConfiguration(10, 5, new SimpleMetricSeriesConfiguration(false));
                Metric metric = client.GetMetric("ChickensSold", config);
                Assert.AreEqual(config, metric.GetConfiguration());
                Assert.AreSame(config, metric.GetConfiguration());
            }

            Util.CompleteDefaultAggregationCycle(pipeline.Metrics());
            pipeline.Dispose();
        }
        public void TestEquals()
        {
            var config1 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.IsTrue(config1.Equals(config1));

            var config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.IsTrue(config1.Equals(config2));
            Assert.IsTrue(config2.Equals(config1));

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: true));

            Assert.IsFalse(config1.Equals(config2));
            Assert.IsFalse(config2.Equals(config1));

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new AccumulatorMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.IsFalse(config1.Equals(config2));
            Assert.IsFalse(config2.Equals(config1));

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    101,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.IsFalse(config1.Equals(config2));
            Assert.IsFalse(config2.Equals(config1));

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1001,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.IsFalse(config1.Equals(config2));
            Assert.IsFalse(config2.Equals(config1));
        }
        public void TestGetHashCode()
        {
            var config1 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.AreNotEqual(0, config1.GetHashCode());

            var config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.AreEqual(config1.GetHashCode(), config2.GetHashCode());

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: true));

            Assert.AreNotEqual(config1.GetHashCode(), config2.GetHashCode());
            Assert.AreNotEqual(0, config2.GetHashCode());

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new AccumulatorMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.AreNotEqual(config1.GetHashCode(), config2.GetHashCode());
            Assert.AreNotEqual(0, config2.GetHashCode());

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1000,
                valuesPerDimensionLimit:    101,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.AreNotEqual(config1.GetHashCode(), config2.GetHashCode());
            Assert.AreNotEqual(0, config2.GetHashCode());

            config2 = new SimpleMetricConfiguration(
                seriesCountLimit:           1001,
                valuesPerDimensionLimit:    100,
                seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));

            Assert.AreNotEqual(config1.GetHashCode(), config2.GetHashCode());
            Assert.AreNotEqual(0, config2.GetHashCode());
        }
        /// <summary />
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(SimpleMetricConfiguration other)
        {
            if (other == null)
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return((this.SeriesCountLimit == other.SeriesCountLimit) &&
                   (this.ValuesPerDimensionLimit == other.ValuesPerDimensionLimit) &&
                   (this.SeriesConfig.Equals(other.SeriesConfig)));
        }
 public void Ctor()
 {
     {
         var config = new SimpleMetricConfiguration(
             seriesCountLimit:           1000,
             valuesPerDimensionLimit:    100,
             seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false));
         Assert.IsNotNull(config);
         Assert.AreEqual(1000, config.SeriesCountLimit);
         Assert.AreEqual(100, config.ValuesPerDimensionLimit);
         Assert.IsNotNull(config.SeriesConfig);
         Assert.IsInstanceOfType(config.SeriesConfig, typeof(SimpleMetricSeriesConfiguration));
         Assert.AreEqual(false, config.SeriesConfig.RequiresPersistentAggregation);
         Assert.AreEqual(false, ((SimpleMetricSeriesConfiguration)config.SeriesConfig).RestrictToUInt32Values);
     }
     {
         var config = new SimpleMetricConfiguration(
             seriesCountLimit:           1,
             valuesPerDimensionLimit:    0,
             seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: true));
         Assert.IsNotNull(config);
         Assert.AreEqual(1, config.SeriesCountLimit);
         Assert.AreEqual(0, config.ValuesPerDimensionLimit);
         Assert.IsNotNull(config.SeriesConfig);
         Assert.IsInstanceOfType(config.SeriesConfig, typeof(SimpleMetricSeriesConfiguration));
         Assert.AreEqual(false, config.SeriesConfig.RequiresPersistentAggregation);
         Assert.AreEqual(true, ((SimpleMetricSeriesConfiguration)config.SeriesConfig).RestrictToUInt32Values);
     }
     {
         var config = new SimpleMetricConfiguration(
             seriesCountLimit:           Int32.MaxValue,
             valuesPerDimensionLimit:    Int32.MaxValue,
             seriesConfig:               new AccumulatorMetricSeriesConfiguration(restrictToUInt32Values: false));
         Assert.IsNotNull(config);
         Assert.AreEqual(Int32.MaxValue, config.SeriesCountLimit);
         Assert.AreEqual(Int32.MaxValue, config.ValuesPerDimensionLimit);
         Assert.IsNotNull(config.SeriesConfig);
         Assert.IsInstanceOfType(config.SeriesConfig, typeof(AccumulatorMetricSeriesConfiguration));
         Assert.AreEqual(true, config.SeriesConfig.RequiresPersistentAggregation);
         Assert.AreEqual(false, ((AccumulatorMetricSeriesConfiguration)config.SeriesConfig).RestrictToUInt32Values);
     }
     {
         Assert.ThrowsException <ArgumentOutOfRangeException>(() => new SimpleMetricConfiguration(
                                                                  seriesCountLimit:           0,
                                                                  valuesPerDimensionLimit:    100,
                                                                  seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false)));
     }
     {
         Assert.ThrowsException <ArgumentOutOfRangeException>(() => new SimpleMetricConfiguration(
                                                                  seriesCountLimit:           -1,
                                                                  valuesPerDimensionLimit:    100,
                                                                  seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false)));
     }
     {
         Assert.ThrowsException <ArgumentOutOfRangeException>(() => new SimpleMetricConfiguration(
                                                                  seriesCountLimit:           1000,
                                                                  valuesPerDimensionLimit:    -1,
                                                                  seriesConfig:               new SimpleMetricSeriesConfiguration(restrictToUInt32Values: false)));
     }
     {
         Assert.ThrowsException <ArgumentNullException>(() => new SimpleMetricConfiguration(
                                                            seriesCountLimit:           1000,
                                                            valuesPerDimensionLimit:    100,
                                                            seriesConfig:               null));
     }
 }
コード例 #6
0
        public void GetMetric_DetectsMetricConfigurationConflicts()
        {
            IList <ITelemetry>     sentTelemetry;
            TelemetryConfiguration telemetryPipeline = Util.CreateAITelemetryConfig(out sentTelemetry);
            TelemetryClient        client            = new TelemetryClient(telemetryPipeline);

            {
                Metric m1 = client.GetMetric("M01");
                Assert.IsNotNull(m1);

                Metric m2 = client.GetMetric("M01");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M01 ");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M01", MetricConfigurations.Measurement);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M01", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M01", MetricConfigurations.Accumulator));

                IMetricConfiguration config1 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                IMetricConfiguration config2 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                Assert.AreEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                m1 = client.GetMetric("M02", config1);
                Assert.IsNotNull(m1);

                m2 = client.GetMetric("M02", config2);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M02", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                config2 = new SimpleMetricConfiguration(10, 101, new SimpleMetricSeriesConfiguration(false));
                Assert.AreNotEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M02", config2));
                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M02 ", config2));
            }
            {
                Metric m1 = client.GetMetric("M11", "Dim1");
                Assert.IsNotNull(m1);

                Metric m2 = client.GetMetric("M11", "Dim1");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric(" M11", "Dim1");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M11", " Dim1");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric(" M11", " Dim1", MetricConfigurations.Measurement);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M11", "Dim1", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M11", "Dim1 ", MetricConfigurations.Accumulator));

                IMetricConfiguration config1 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                IMetricConfiguration config2 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                Assert.AreEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                m1 = client.GetMetric("M12 ", "Dim1", config1);
                Assert.IsNotNull(m1);

                m2 = client.GetMetric("M12", "Dim1 ", config2);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M12", "Dim1", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                config2 = new SimpleMetricConfiguration(10, 101, new SimpleMetricSeriesConfiguration(false));
                Assert.AreNotEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M12", "Dim1", config2));
                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M12 ", "Dim1", config2));
            }
            {
                Metric m1 = client.GetMetric("M21", "Dim1", "Dim2");
                Assert.IsNotNull(m1);

                Metric m2 = client.GetMetric("M21", "Dim1", "Dim2");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric(" M21", "Dim1", "Dim2");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M21", " Dim1", "Dim2");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M21", "Dim1", " Dim2");
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric(" M21", " Dim1", "Dim2", MetricConfigurations.Measurement);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M21", "Dim1", "Dim2 ", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M21", "Dim1 ", "Dim2", MetricConfigurations.Accumulator));

                IMetricConfiguration config1 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                IMetricConfiguration config2 = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(false));
                Assert.AreEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                m1 = client.GetMetric("M22 ", "Dim1", "Dim2 ", config1);
                Assert.IsNotNull(m1);

                m2 = client.GetMetric("M22", "Dim1 ", "Dim2", config2);
                Assert.AreSame(m1, m2);

                m2 = client.GetMetric("M22", "Dim1", "Dim2", metricConfiguration: null);
                Assert.AreSame(m1, m2);

                config2 = new SimpleMetricConfiguration(10, 101, new SimpleMetricSeriesConfiguration(false));
                Assert.AreNotEqual(config1, config2);
                Assert.AreNotSame(config1, config2);

                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M22", "Dim1", "Dim2", config2));
                Assert.ThrowsException <ArgumentException>(() => client.GetMetric("M22 ", "Dim1", "Dim2", config2));
            }
            {
                Metric m0 = client.GetMetric("Xxx");
                Metric m1 = client.GetMetric("Xxx", "Dim1");
                Metric m2 = client.GetMetric("Xxx", "Dim1", "Dim2");

                Assert.IsNotNull(m0);
                Assert.IsNotNull(m1);
                Assert.IsNotNull(m2);

                Assert.AreNotSame(m0, m1);
                Assert.AreNotSame(m0, m2);
                Assert.AreNotSame(m1, m2);

                Assert.AreSame(m0.GetConfiguration(), m1.GetConfiguration());
                Assert.AreSame(m0.GetConfiguration(), m2.GetConfiguration());
                Assert.AreSame(m1.GetConfiguration(), m2.GetConfiguration());

                Assert.AreSame(MetricConfigurations.Measurement, m0.GetConfiguration());
            }

            Util.CompleteDefaultAggregationCycle(telemetryPipeline.Metrics());
            telemetryPipeline.Dispose();
        }
コード例 #7
0
        public void GetMetric_RespectsMetricConfiguration()
        {
            IList <ITelemetry>     sentTelemetry;
            TelemetryConfiguration telemetryPipeline = Util.CreateAITelemetryConfig(out sentTelemetry);
            TelemetryClient        client            = new TelemetryClient(telemetryPipeline);

            {
                Metric metric = client.GetMetric("M1");
                Assert.IsNotNull(metric);
                Assert.AreEqual(0, metric.DimensionsCount);
                Assert.AreEqual("M1", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M2", MetricConfigurations.Measurement);
                Assert.IsNotNull(metric);
                Assert.AreEqual(0, metric.DimensionsCount);
                Assert.AreEqual("M2", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M3", MetricConfigurations.Accumulator);
                Assert.IsNotNull(metric);
                Assert.AreEqual(0, metric.DimensionsCount);
                Assert.AreEqual("M3", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Accumulator, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
            }
            {
                IMetricConfiguration config = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(true));
                Metric metric = client.GetMetric("M4", config);
                Assert.IsNotNull(metric);
                Assert.AreEqual(0, metric.DimensionsCount);
                Assert.AreEqual("M4", metric.MetricId);
                Assert.AreEqual(config, metric.GetConfiguration());
                Assert.AreSame(config, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
                Assert.AreNotSame(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M5", "Dim1");
                Assert.IsNotNull(metric);
                Assert.AreEqual(1, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("M5", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val"));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M6", "Dim1", MetricConfigurations.Measurement);
                Assert.IsNotNull(metric);
                Assert.AreEqual(1, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("M6", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val"));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M7", "Dim1", MetricConfigurations.Accumulator);
                Assert.IsNotNull(metric);
                Assert.AreEqual(1, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("M7", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Accumulator, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val"));
                Assert.AreEqual(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
            }
            {
                IMetricConfiguration config = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(true));
                Metric metric = client.GetMetric("M8", "Dim1", config);
                Assert.IsNotNull(metric);
                Assert.AreEqual(1, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("M8", metric.MetricId);
                Assert.AreEqual(config, metric.GetConfiguration());
                Assert.AreSame(config, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(config.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(config.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val"));
                Assert.AreEqual(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
                Assert.AreNotSame(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M9", "Dim1", "Dim2");
                Assert.IsNotNull(metric);
                Assert.AreEqual(2, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("Dim2", metric.GetDimensionName(2));
                Assert.AreEqual("M9", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val", "Dim2val"));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M10", "Dim1", "Dim2", MetricConfigurations.Measurement);
                Assert.IsNotNull(metric);
                Assert.AreEqual(2, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("Dim2", metric.GetDimensionName(2));
                Assert.AreEqual("M10", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Measurement, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val", "Dim2val"));
                Assert.AreEqual(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Measurement.SeriesConfig, series.GetConfiguration());
            }
            {
                Metric metric = client.GetMetric("M11", "Dim1", "Dim2", MetricConfigurations.Accumulator);
                Assert.IsNotNull(metric);
                Assert.AreEqual(2, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("Dim2", metric.GetDimensionName(2));
                Assert.AreEqual("M11", metric.MetricId);
                Assert.AreEqual(MetricConfigurations.Accumulator, metric.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val", "Dim2val"));
                Assert.AreEqual(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(MetricConfigurations.Accumulator.SeriesConfig, series.GetConfiguration());
            }
            {
                IMetricConfiguration config = new SimpleMetricConfiguration(10, 10, new SimpleMetricSeriesConfiguration(true));
                Metric metric = client.GetMetric("M12", "Dim1", "Dim2", config);
                Assert.IsNotNull(metric);
                Assert.AreEqual(2, metric.DimensionsCount);
                Assert.AreEqual("Dim1", metric.GetDimensionName(1));
                Assert.AreEqual("Dim2", metric.GetDimensionName(2));
                Assert.AreEqual("M12", metric.MetricId);
                Assert.AreEqual(config, metric.GetConfiguration());
                Assert.AreSame(config, metric.GetConfiguration());

                MetricSeries series;
                Assert.IsTrue(metric.TryGetDataSeries(out series));
                Assert.AreEqual(config.SeriesConfig, series.GetConfiguration());
                Assert.AreSame(config.SeriesConfig, series.GetConfiguration());
                Assert.IsTrue(metric.TryGetDataSeries(out series, "Dim1Val", "Dim2val"));
                Assert.AreEqual(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
                Assert.AreNotSame(new SimpleMetricSeriesConfiguration(true), series.GetConfiguration());
                Assert.AreSame(config.SeriesConfig, series.GetConfiguration());
            }

            Util.CompleteDefaultAggregationCycle(telemetryPipeline.Metrics());
        }