Ejemplo n.º 1
0
        public void TestGeneratePointlessResponse()
        {
            var generator = new PointlessChatterGenerator();

            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("hi"));
            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("Hi"));
            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("hi "));
            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("hi!"));
            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("hi there"));
            Assert.AreEqual(PointlessChatterGenerator.GenericGreeting, generator.GeneratePointlessResponse("unknown"));
            Assert.AreEqual(PointlessChatterGenerator.Fine, generator.GeneratePointlessResponse("How are you?"));
        }
Ejemplo n.º 2
0
        public Activity BuildReplyActivity(Activity messageActivity, IUserData userData)
        {
            var pointlessResponse = chatterGenerator.GeneratePointlessResponse(messageActivity.Text);
            var sb = new StringBuilder();

            sb.Append(pointlessResponse);
            if (PointlessChatterGenerator.ShouldMakeSuggestion(pointlessResponse))
            {
                sb.Append(' ');
                GenerateSuggestion(sb);
            }

            return(messageActivity.CreateReply(sb.ToString()));
        }