Ejemplo n.º 1
0
 public TestsDialog()
 {
     this.triggerToHandler = new Dictionary <string, Func <string, IEnumerable <TestReply> > >(StringComparer.InvariantCultureIgnoreCase)
     {
         {
             TriggerIs(HELPTRIGGER),
             (input) =>
             {
                 var reply = string.Join("<br />", this.triggerToHandler.Keys);
                 return(TestsDialog.BuildMessage(null, reply));
             }
         },
         {
             TriggerIs("hero1"),
             (input) =>
             {
                 return(TestsDialog.BuildMessage(new List <Attachment>()
                 {
                     // Card with everything
                     TestsDialog.GetHeroCardAttachment(
                         "Subject Title",
                         "Subtitle or breadcrumb",
                         "Bacon ipsum dolor amet flank ground round chuck pork loin. Sirloin meatloaf boudin meatball ham hock shoulder capicola tri-tip sausage biltong cupim",
                         "attribution",
                         new string[] { "https://skypeteamsbotstorage.blob.core.windows.net/bottestartifacts/screenshot_16x9.png" },
                         new string[] { "View in article", "See more like this", "/test ipsum" })
                 }));
             }
         }
     };
 }
Ejemplo n.º 2
0
        /*
         * /// <summary>
         * /// Returns a response representing if this service should service the request.
         * /// </summary>
         * /// <param name="question">Question instance.</param>
         * /// <returns>
         * /// True if request should be serviced, false otherwise.
         * /// </returns>
         * public Task<bool> ShouldTrigger(IQuestion question)
         * {
         *  return Task.FromResult<bool>(this.triggerToHandler.Keys.Any((val) => question.Content.StartsWith(val, StringComparison.InvariantCultureIgnoreCase)));
         * }
         */

        /// <summary>
        /// Builds an <see cref="IAnswer" /> using the supplied info and returns it/>
        /// </summary>
        /// <param name="attachments">Attachments for the answer</param>
        /// <param name="confidence">Confidence for the answer</param>
        /// <param name="content">Content of the answer</param>
        /// <param name="attachmentLayout">Attachment layout</param>
        /// <returns>Answer capturing the supplied info</returns>
        private static IEnumerable <TestReply> BuildMessage(List <Attachment> attachments, string content = null, AttachmentLayout attachmentLayout = AttachmentLayout.Carousel)
        {
            return(TestsDialog.BuildMessage(attachments: attachments, content: content, summary: null, contentFormat: null, attachmentLayout: attachmentLayout));
        }