Ejemplo n.º 1
0
 public void TestGetValueThrows()
 {
     Private.BooleanMetricType booleanMetric = new Private.BooleanMetricType(
         category: "telemetry",
         disabled: true,
         lifetime: Private.Lifetime.Application,
         name: "boolean_metric",
         sendInPings: new string[] { "store1" }
         );
     Assert.Throws <NullReferenceException>(() => booleanMetric.TestGetValue());
 }
Ejemplo n.º 2
0
        public void APISavesToSecondaryPings()
        {
            Private.BooleanMetricType booleanMetric = new Private.BooleanMetricType(
                category: "telemetry",
                disabled: false,
                lifetime: Private.Lifetime.Application,
                name: "boolean_metric",
                sendInPings: new string[] { "store1", "store2" }
                );

            // Record two strings of the same type, with a little delay.
            booleanMetric.Set(true);

            // Check that data was properly recorded in the second ping.
            Assert.True(booleanMetric.TestHasValue("store2"));
            Assert.True(booleanMetric.TestGetValue("store2"));

            booleanMetric.Set(false);
            // Check that data was properly recorded in the second ping.
            Assert.True(booleanMetric.TestHasValue("store2"));
            Assert.False(booleanMetric.TestGetValue("store2"));
        }