public void APISavesToSecondaryPings() { Private.JweMetricType jweMetric = new Private.JweMetricType( category: "telemetry", disabled: false, lifetime: Private.Lifetime.Application, name: "jwe_metric", sendInPings: new string[] { "store1", "store2" } ); // Record two JWEs of the same type, with a little delay. jweMetric.Set(this.header, this.key, this.initVector, this.cipherText, this.authTag); // Check that data was properly recorded in the second ping. Assert.True(jweMetric.TestHasValue("store2")); Assert.Equal(this.jwe, jweMetric.testGetCompactRepresentation("store2")); jweMetric.Set(this.header, "", "", this.cipherText, ""); // Check that data was properly recorded in the second ping. Assert.True(jweMetric.TestHasValue("store2")); Assert.Equal(this.minimumJwe, jweMetric.testGetCompactRepresentation("store2")); }
public void DisabledJwesMustNotRecordData() { Private.JweMetricType jweMetric = new Private.JweMetricType( category: "telemetry", disabled: true, lifetime: Private.Lifetime.Application, name: "jwe_metric", sendInPings: new string[] { "store1" } ); // Attempt to store the string. jweMetric.Set(this.header, this.key, this.initVector, this.cipherText, this.authTag); // Check that nothing was recorded. Assert.False(jweMetric.TestHasValue(), "JWEs must not be recorded if they are disabled"); }