public void BooleanRecognizer_NeutralExpression_ReturnsNull(string input)
        {
            var booleanRecognizer = new BooleanRecognizer();
            var msg = new Mock <IMessageActivity>();

            msg.SetupGet(m => m.Text).Returns(input);

            var result = booleanRecognizer.RecognizeEntity(msg.Object);

            Assert.Null(result);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LuisPrompt"/> class.
 /// </summary>
 /// <param name="luisServices">LUIS services interpreting responses other than yes/no</param>
 /// <param name="prompt">The prompt.</param>
 /// <param name="attempts">Maximum number of attempts.</param>
 /// <param name="retry">What to show on retry.</param>
 /// <param name="luisIntents">Intents for luis to limit query</param>
 /// <param name="patterns">Yes and no alternatives for matching input where first dimension is either <see cref="PromptDialog.PromptConfirm.Yes"/> or <see cref="PromptDialog.PromptConfirm.No"/> and the arrays are alternative strings to match.</param>
 /// <param name="tooManyAttempts">What to display when user didn't say a valid response after <see cref="attempts"/>.</param>
 /// <param name="isLuisUsedFirst">Whether Luis or regular prompt should be checked first.</param>
 private LuisPrompt(ILuisService[] luisServices, string prompt, int attempts, string retry = null, string[] luisIntents = null, string[][] patterns = null, string tooManyAttempts = null, bool isLuisUsedFirst = true)
 {
     this.luisServices    = luisServices;
     this.prompt          = prompt;
     this.attempts        = attempts;
     this.retry           = retry ?? new PromptDialog.PromptConfirm(this.prompt, this.retry, this.attempts).DefaultRetry; //just to steal retry message;
     this.luisIntents     = luisIntents;
     this.recognizer      = new BooleanRecognizer(patterns);
     this.tooManyAttempts = tooManyAttempts ?? Microsoft.Bot.Builder.Resource.Resources.TooManyAttempts;
     this.isLuisUsedFirst = isLuisUsedFirst;
 }
        public void BooleanRecognizerWithCustomPatterns_MisspelledNegativeExpression_ReturnsFalse(string input)
        {
            string[][] patterns = { "Yes;y;sure;ok;yep".SplitList(), "No;n;nope;Nop".SplitList() };

            var booleanRecognizer = new BooleanRecognizer(patterns);
            var msg = new Mock <IMessageActivity>();

            msg.SetupGet(m => m.Text).Returns(input);

            var result = booleanRecognizer.RecognizeEntity(msg.Object);

            Assert.False(result);
        }