public void GivenEmptyActivity_WhenTrackCustomEventIsInvoked_ThenExceptionIsBeingThrown( InstrumentationSettings settings) { // Arrange var instrumentation = new CustomInstrumentation(this.telemetryClient, settings); const IActivity emptyActivity = null; // Act // Assert Assert.Throws <ArgumentNullException>(() => instrumentation.TrackCustomEvent(emptyActivity)); }
public void GivenAnyActivity_WhenTrackCustomEventIsInvoked_ThenEventTelemetryIsBeingSent( IMessageActivity activity, InstrumentationSettings settings) { // Arrange var instrumentation = new CustomInstrumentation(this.telemetryClient, settings); // Act instrumentation.TrackCustomEvent(activity); // Assert this.mockTelemetryChannel.Verify( tc => tc.Send(It.Is <EventTelemetry>(t => t.Name == EventTypes.CustomEvent)), Times.Once); }
public void GivenAnyActivityAnyEventNameAndAnyProperty_WhenTrackCustomEventIsInvoked_ThenEventTelemetryIsBeingSent( IMessageActivity activity, string eventName, string propertyKey, string propertyValue, InstrumentationSettings settings) { // Arrange var instrumentation = new CustomInstrumentation(this.telemetryClient, settings); var properties = new Dictionary <string, string> { { propertyKey, propertyValue } }; // Act instrumentation.TrackCustomEvent(activity, eventName, properties); // Assert this.mockTelemetryChannel.Verify( tc => tc.Send(It.Is <EventTelemetry>(t => t.Name == eventName && t.Properties[propertyKey] == propertyValue)), Times.Once); }