コード例 #1
0
 public void MetricTelemetryDeepCloneWithNullExtensionDoesNotThrow()
 {
     var telemetry = new MetricTelemetry();
     // Extension is not set, means it'll be null.
     // Validate that cloning with null Extension does not throw.
     var other = telemetry.DeepClone();
 }
コード例 #2
0
        public void MetricTelemetryDeepCloneCopiesAllProperties()
        {
            var metric = new MetricTelemetry();

            metric.Name = "My Page";
#pragma warning disable CS0618
            metric.Value = 42;
#pragma warning restore CS0618
            metric.Count             = 5;
            metric.Min               = 1.2;
            metric.Max               = 6.4;
            metric.StandardDeviation = 0.5;
            metric.Properties.Add("Property1", "Value1");

            MetricTelemetry other = (MetricTelemetry)metric.DeepClone();

            CompareLogic deepComparator   = new CompareLogic();
            var          comparisonResult = deepComparator.Compare(metric, other);
            Assert.IsTrue(comparisonResult.AreEqual, comparisonResult.DifferencesString);
        }