public void GIVENEmptyQueryResult_WHENTrackIntentIsInvoked_THENExceptionIsBeingThrown(
            IMessageActivity activity,
            InstrumentationSettings settings)
        {
            // Arrange
            var instrumentation = new IntentInstrumentation(this.telemetryClient, settings);
            const LuisResult emptyLuisResult = null;

            // Act
            // Assert
            Assert.Throws <ArgumentNullException>(() => instrumentation.TrackIntent(activity, emptyLuisResult));
        }
        public void GivenEmptyActivity_WhenTrackIntentIsInvoked_ThenExceptionIsBeingThrown(
            RecognizerResult luisResult,
            InstrumentationSettings settings)
        {
            // Arrange
            var instrumentation = new IntentInstrumentation(this.telemetryClient, settings);
            const IMessageActivity emptyActivity = null;

            // Act
            // Assert
            Assert.Throws <ArgumentNullException>(() => instrumentation.TrackIntent(emptyActivity, luisResult));
        }
        public void GIVENAnyActivity_WHENTrackIntentIsInvoked_THENEventTelemetryIsBeingSent(
            IMessageActivity activity,
            LuisResult luisResult,
            InstrumentationSettings settings)
        {
            // Arrange
            var instrumentation = new IntentInstrumentation(this.telemetryClient, settings);

            // Act
            instrumentation.TrackIntent(activity, luisResult);

            // Assert
            this.mockTelemetryChannel.Verify(
                tc => tc.Send(It.Is <EventTelemetry>(t =>
                                                     t.Name == EventTypes.Intent &&
                                                     t.Properties[IntentConstants.Intent] == luisResult.TopScoringIntent.Intent &&
                                                     t.Properties[IntentConstants.Score] == luisResult.TopScoringIntent.Score.ToString() &&
                                                     t.Properties[IntentConstants.Entities] == JsonConvert.SerializeObject(luisResult.Entities))),
                Times.Once);
        }
        public void GivenAnyActivity_WhenTrackIntentIsInvoked_ThenEventTelemetryIsBeingSent(
            IMessageActivity activity,
            RecognizerResult luisResult,
            InstrumentationSettings settings)
        {
            // Arrange
            var instrumentation  = new IntentInstrumentation(this.telemetryClient, settings);
            var topScoringIntent = luisResult.GetTopScoringIntent();

            // Act
            instrumentation.TrackIntent(activity, luisResult);

            // Assert
            this.mockTelemetryChannel.Verify(
                tc => tc.Send(It.Is <EventTelemetry>(t =>
                                                     t.Name == EventTypes.Intent &&
                                                     t.Properties[IntentConstants.Intent] == topScoringIntent.intent &&
                                                     t.Properties[IntentConstants.Score] == topScoringIntent.score.ToString(CultureInfo.InvariantCulture) &&
                                                     t.Properties[IntentConstants.Entities] == luisResult.Entities.ToString(Formatting.None))),
                Times.Once);
        }