public SentimentInstrumentationMiddleware( TelemetryClient telemetryClient, ISentimentClient sentimentClient, InstrumentationSettings instrumentationSettings) { this.sentimentClient = sentimentClient ?? throw new ArgumentNullException(nameof(sentimentClient)); this.sentimentInstrumentation = new SentimentInstrumentation(this.sentimentClient, telemetryClient, instrumentationSettings); }
public void GIVENEmptyActivity_WHENSentimentDialogActivityLoggerIsCreated_THENExceptionIsBeingThrown() { // Arrange const ISentimentInstrumentation sentimentInstrumentation = null; // Act // Assert Assert.Throws <ArgumentNullException>(() => new SentimentDialogActivityLogger(sentimentInstrumentation)); }
public async void GIVENActivity_WHENLogAsyncIsInvoked_THENTrackMessageSentimentIsInvoked( IActivity activity, ISentimentInstrumentation sentimentInstrumentation) { // Arrange var instrumentation = new SentimentDialogActivityLogger(sentimentInstrumentation); // Act await instrumentation.LogAsync(activity).ConfigureAwait(false); // Assert Mock.Get(sentimentInstrumentation).Verify( ai => ai.TrackMessageSentiment(activity), Times.Once); }
public SentimentDialogActivityLogger(ISentimentInstrumentation sentimentInstrumentation) { this.sentimentInstrumentation = sentimentInstrumentation ?? throw new ArgumentNullException(nameof(sentimentInstrumentation)); }