private Initialize ( |
||
source | ||
instrumentationKey | string | |
리턴 | void |
public void InitializeSetsTelemetryInstrumentationKeyFromArgument() { var source = new TelemetryContext { InstrumentationKey = "TestValue" }; var target = new TelemetryContext(); target.Initialize(source, "OtherTestValue"); Assert.Equal("OtherTestValue", target.InstrumentationKey); }
public void InitializeDoesNotOverrideTelemetryInstrumentationKey() { var source = new TelemetryContext { InstrumentationKey = "SourceValue" }; var target = new TelemetryContext { InstrumentationKey = "TargetValue" }; target.Initialize(source, source.InstrumentationKey); Assert.Equal("TargetValue", target.InstrumentationKey); }
public void InitializeCopiesTags() { string tagName = "TestTag"; string tagValue = "TestValue"; var source = new TelemetryContext { Tags = { { tagName, tagValue } } }; var target = new TelemetryContext(); target.Initialize(source, source.InstrumentationKey); Assert.Equal(tagValue, target.Tags[tagName]); }
private static string CopyAndSerialize(TelemetryContext source) { // Create a copy of the source context to verify that Serialize writes property values stored in tags // dictionary even if their context objects (User, Location, etc) haven't been initialized yet. var target = new TelemetryContext(); target.Initialize(source, source.InstrumentationKey); using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { ((IJsonSerializable)target).Serialize(new JsonWriter(stringWriter)); return(stringWriter.ToString()); } }
public void InitializeDoesNotOverwriteTags() { string tagName = "TestTag"; var source = new TelemetryContext { Tags = { { tagName, "Source Value" } } }; var target = new TelemetryContext { Tags = { { tagName, "Target Value" } } }; target.Initialize(source, source.InstrumentationKey); Assert.Equal("Target Value", target.Tags[tagName]); }
public void InitializeCopiesTags() { string tagName = "TestTag"; string tagValue = "TestValue"; var source = new TelemetryContext { Tags = { { tagName, tagValue } } }; var target = new TelemetryContext(); target.Initialize(source, source.InstrumentationKey); Assert.Equal(tagValue, target.Tags[tagName]); }
private static string CopyAndSerialize(TelemetryContext source) { // Create a copy of the source context to verify that Serialize writes property values stored in tags // dictionary even if their context objects (User, Location, etc) haven't been initialized yet. var target = new TelemetryContext(); target.Initialize(source, source.InstrumentationKey); using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { ((IJsonSerializable)target).Serialize(new JsonWriter(stringWriter)); return stringWriter.ToString(); } }
public void InitializeDoesNotOverrideTelemetryInstrumentationKey() { var source = new TelemetryContext { InstrumentationKey = "SourceValue" }; var target = new TelemetryContext { InstrumentationKey = "TargetValue" }; target.Initialize(source, source.InstrumentationKey); Assert.Equal("TargetValue", target.InstrumentationKey); }
public void InitializeSetsTelemetryInstrumentationKeyFromArgument() { var source = new TelemetryContext { InstrumentationKey = "TestValue" }; var target = new TelemetryContext(); target.Initialize(source, "OtherTestValue"); Assert.Equal("OtherTestValue", target.InstrumentationKey); }
public void InitializeDoesNotOverwriteTags() { string tagName = "TestTag"; var source = new TelemetryContext { Tags = { { tagName, "Source Value" } } }; var target = new TelemetryContext { Tags = { { tagName, "Target Value" } } }; target.Initialize(source, source.InstrumentationKey); Assert.Equal("Target Value", target.Tags[tagName]); }