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 DisabledstringsMustNotRecordData()
        {
            Private.BooleanMetricType booleanMetric = new Private.BooleanMetricType(
                category: "telemetry",
                disabled: true,
                lifetime: Private.Lifetime.Application,
                name: "boolean_metric",
                sendInPings: new string[] { "store1" }
                );

            // Attempt to store the string.
            booleanMetric.Set(true);
            // Check that nothing was recorded.
            Assert.False(booleanMetric.TestHasValue(), "Booleans must not be recorded if they are disabled");
        }
Ejemplo n.º 3
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"));
        }