public void APISavesToSecondaryPings() { // Define a 'uuidMetric' uuid metric, which will be stored in "store1" and "store2" var uuidMetric = new Private.UuidMetricType( category: "telemetry", disabled: false, lifetime: Private.Lifetime.Application, name: "uuid_metric", sendInPings: new string[] { "store1", "store2" } ); // Record two uuids of the same type, with a little delay. var uuid = uuidMetric.GenerateAndSet(); // Check that data was properly recorded. Assert.True(uuidMetric.TestHasValue("store2")); Assert.Equal(uuid, uuidMetric.TestGetValue("store2")); var uuid2 = System.Guid.NewGuid(); uuidMetric.Set(uuid2); // Check that data was properly recorded. Assert.True(uuidMetric.TestHasValue("store2")); Assert.Equal(uuid2, uuidMetric.TestGetValue("store2")); }
public void TestGetValueThrows() { var uuidMetric = new Private.UuidMetricType( category: "telemetry", disabled: true, lifetime: Private.Lifetime.Application, name: "uuid_metric", sendInPings: new string[] { "store1" } ); Assert.Throws <NullReferenceException>(() => uuidMetric.TestGetValue()); }
public void DisabledstringsMustNotRecordData() { // Define a 'uuidMetric' uuid metric, which will be stored in "store1". It's disabled // so it should not record anything. var uuidMetric = new Private.UuidMetricType( category: "telemetry", disabled: true, lifetime: Private.Lifetime.Application, name: "uuid_metric", sendInPings: new string[] { "store1" } ); // Attempt to store the uuid. uuidMetric.GenerateAndSet(); // Check that nothing was recorded. Assert.False(uuidMetric.TestHasValue(), "Uuids must not be recorded if they are disabled"); }