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); }
/// <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); }
// 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); }
public void Invalid_Handle_Throws_Error() { var service = new Mock <ILuisService>(); var dialog = new InvalidLuisDialog(service.Object); var handlers = LuisDialog.EnumerateHandlers(dialog).ToArray(); }
public ExceptionHandlerLuisDialog(LuisDialog <T> dialog, bool displayException, int stackTraceLength = 500) { _dialog = dialog; _displayException = displayException; _stackTraceLength = stackTraceLength; }