public void TestGetValueThrows() { Private.StringMetricType stringMetric = new Private.StringMetricType( category: "telemetry", disabled: true, lifetime: Private.Lifetime.Application, name: "string_metric", sendInPings: new string[] { "store1" } ); Assert.Throws <NullReferenceException>(() => stringMetric.TestGetValue()); }
public void APISavesToSecondaryPings() { Private.StringMetricType stringMetric = new Private.StringMetricType( category: "telemetry", disabled: false, lifetime: Private.Lifetime.Application, name: "string_metric", sendInPings: new string[] { "store1", "store2" } ); // Record two strings of the same type, with a little delay. stringMetric.Set("value"); // Check that data was properly recorded in the second ping. Assert.True(stringMetric.TestHasValue("store2")); Assert.Equal("value", stringMetric.TestGetValue("store2")); stringMetric.Set("overriddenValue"); // Check that data was properly recorded in the second ping. Assert.True(stringMetric.TestHasValue("store2")); Assert.Equal("overriddenValue", stringMetric.TestGetValue("store2")); }