示例#1
0
 public SentimentInstrumentationMiddleware(
     TelemetryClient telemetryClient,
     ISentimentClient sentimentClient,
     InstrumentationSettings instrumentationSettings)
 {
     this.sentimentClient          = sentimentClient ?? throw new ArgumentNullException(nameof(sentimentClient));
     this.sentimentInstrumentation = new SentimentInstrumentation(this.sentimentClient, telemetryClient, instrumentationSettings);
 }
示例#2
0
        public void GIVENEmptyActivity_WHENSentimentDialogActivityLoggerIsCreated_THENExceptionIsBeingThrown()
        {
            // Arrange
            const ISentimentInstrumentation sentimentInstrumentation = null;

            // Act
            // Assert
            Assert.Throws <ArgumentNullException>(() => new SentimentDialogActivityLogger(sentimentInstrumentation));
        }
示例#3
0
        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);
        }
示例#4
0
 public SentimentDialogActivityLogger(ISentimentInstrumentation sentimentInstrumentation)
 {
     this.sentimentInstrumentation = sentimentInstrumentation ?? throw new ArgumentNullException(nameof(sentimentInstrumentation));
 }