예제 #1
0
        public void AzureFunctionMsgIn_Welcome_1_0()
        {
            BotState botState = null;
            var      message  = new MessageReceived(new NameValueCollection()
            {
                { "CallSid", Guid.NewGuid().ToString() },
                { "SpeechResult", "hi" }
            });

            var response = MsgIn.ProcessMessage(botState, message);

            Assert.IsTrue(response.Intent.StartsWith("1.0 "));
            Assert.IsTrue(!string.IsNullOrEmpty(response.ResponseText));
            Assert.AreEqual(1, response.Contexts.Count());
            Assert.AreEqual("participateyesno", response.Contexts[0]);
        }
예제 #2
0
        private void TestStep(ConversationEvent step)
        {
            var message = new MessageReceived(new NameValueCollection()
            {
                { "CallSid", sessionId },
                { "SpeechResult", step.Text }
            });

            var response = MsgIn.ProcessMessage(botState, message);

            Assert.IsTrue(response.Intent.StartsWith(step.IntentStartsWith), $"Expected {step.IntentStartsWith} but intent was {response.Intent}");

            var contexts = string.Join(", ", response.Contexts);

            Assert.AreEqual(step.Context, contexts);

            botState = response.BotState;
        }