Esempio n. 1
0
        public void GIVENAnyResult_WHENRecognizerResultAdapterIsInvoked_THENActivityIsMapped(RecognizerResult recognizerResult)
        {
            // Arrange
            var adapter          = new RecognizerResultAdapter(recognizerResult);
            var topScoringIntent = recognizerResult.GetTopScoringIntent();

            // Act
            var recognizedIntentResult = adapter.IntentResult;

            // Assert
            Assert.Equal(recognizedIntentResult.Intent, topScoringIntent.intent);
            Assert.Equal(recognizedIntentResult.Score, topScoringIntent.score.ToString(CultureInfo.InvariantCulture));
            Assert.Equal(recognizedIntentResult.Entities, recognizerResult.Entities.ToString(Formatting.None));
        }
Esempio n. 2
0
        public void TrackIntent(IActivity activity, RecognizerResult result)
        {
            BotAssert.ActivityNotNull(activity);

            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var activityAdapter         = new ActivityAdapter(activity);
            var recognizerResultAdapter = new RecognizerResultAdapter(result);

            activityAdapter.TrackIntent(recognizerResultAdapter.IntentResult, this.telemetryClient, this.settings);
        }