Esempio n. 1
0
        public void All_Handlers_Are_Found()
        {
            var service  = new Mock <ILuisService>();
            var dialog   = new DerivedLuisDialog(service.Object);
            var handlers = LuisDialog.EnumerateHandlers(dialog).ToArray();

            Assert.AreEqual(14, handlers.Length);
        }
Esempio n. 2
0
        /// <summary>
        /// POST: api/Messages
        /// Receive a message from a user and reply to it
        /// </summary>
        public async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            if (activity.Type == ActivityTypes.Message)
            {
                var luis = new LuisDialog();
                await Conversation.SendAsync(activity, () => luis);
            }
            else
            {
                HandleSystemMessage(activity);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }
Esempio n. 3
0
        // Dependency injection uses this constructor to instantiate MainDialog
        public MainDialog(LuisBookingRecognizer luisRecognizer, LuisDialog bookingDialog, ILogger <MainDialog> logger)
            : base(nameof(MainDialog))
        {
            _luisRecognizer = luisRecognizer;
            Logger          = logger;

            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(bookingDialog);
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                ActStepAsync,
                FinalStepAsync,
            }));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
Esempio n. 4
0
 public void Invalid_Handle_Throws_Error()
 {
     var service  = new Mock <ILuisService>();
     var dialog   = new InvalidLuisDialog(service.Object);
     var handlers = LuisDialog.EnumerateHandlers(dialog).ToArray();
 }
Esempio n. 5
0
 public ExceptionHandlerLuisDialog(LuisDialog <T> dialog, bool displayException, int stackTraceLength = 500)
 {
     _dialog           = dialog;
     _displayException = displayException;
     _stackTraceLength = stackTraceLength;
 }