Beispiel #1
0
        private MessageContext GetMoreInfo(MessageContext context, Dictionary <string, List <com.valgut.libs.bots.Wit.Models.Entity> > entities)
        {
            var resultContext = new MessageContext {
                Message = ResponsesParser.GetResponse("DoNotUnderstand")
            };

            return(resultContext);
        }
Beispiel #2
0
        private MessageContext ThanksHandler(MessageContext context, Dictionary <string, List <com.valgut.libs.bots.Wit.Models.Entity> > entities)
        {
            var resultContext = new MessageContext {
                Message = ResponsesParser.GetResponse("thanks")
            };

            return(resultContext);
        }
Beispiel #3
0
        /// <summary>
        /// event is fired when the 'ParseXml' is clicked.
        /// </summary>
        private void ParseXml_Click(object sender, EventArgs e)
        {
            // xml
            string xml = File.ReadAllText(SourceXmlControl.Text);

            // Create a new instance of a 'ResponsesParser' object.
            ResponsesParser parser = new ResponsesParser();

            // load the response
            Response response = parser.ParseResponse(xml);

            // if the response object exists
            if (response != null)
            {
                // set each property from the response
                EntityLineNumberControl.Text = response.EntitylineNumber.ToString();
                EntityUIDControl.Text        = response.EntityUID;
                StatusCodeControl.Text       = response.StatusCode;
                EntityMarkControl.Text       = response.EntityMark;
            }
        }
Beispiel #4
0
        public void ShouldProcessResponseCorrectly(string input, string paramKey, string paramValue, string expectedResult, bool shouldTrue)
        {
            //Arrange
            var responsesParser = new ResponsesParser();
            var response        = new Response {
                Message = input
            };
            var param = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>(paramKey, paramValue)
            };

            //Act
            var parsed = responsesParser.Parse(response, param);

            //Assert
            if (shouldTrue)
            {
                Assert.That(parsed, Is.EqualTo(expectedResult));
            }
            else
            {
                Assert.That(parsed, Is.Not.EqualTo(expectedResult));
            }
        }