Beispiel #1
0
        public static ParseResult <TSchema> Parse <TSchema>(this IEntityParser <TSchema> parser, string text)
            where TSchema : Entity
        {
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            var stringText = new StringText(text);

            return(parser.Parse(stringText, new TextSpan(0, stringText.Length)));
        }
Beispiel #2
0
        public async Task BookRoom(IDialogContext context, LuisResult result)
        {
            IList <object> Values = new List <object>();

            foreach (var e in result.Entities)
            {
                var entity = ChainOfCommand.Parse(e);
                if (entity != null)
                {
                    Values.Add(entity);
                }
            }

            var form = new FormDialog <RoomReservationForm>(new RoomReservationForm(Values.ToArray()), RoomReservationForm.BuildForm);
            await context.Forward(form, RoomReservationCallBackAsync, null);
        }
Beispiel #3
0
        private SingleObjectResult <T> GetResult <T>(string action, string parameters, string xPath, IEntityParser <T> parser) where T : class
        {
            StatusInfo status;
            var        doc = this.requestProcessor.Process(action, parameters, out status);

            if (!ResponseIsOk(doc, status))
            {
                return(new SingleObjectResult <T>(status));
            }

            var node = doc.SelectSingleNode(xPath);

            if (node == null)
            {
                return(new SingleObjectResult <T>(status));
            }

            return(new SingleObjectResult <T>(status, parser.Parse(node)));
        }
Beispiel #4
0
 public void EnsureThatParsingOnNullTextReaderThrowsException()
 {
     Assert.ThrowsAny <ArgumentNullException>(() => _parser.Parse(null));
 }
 private IEnumerable <XElement> Parse(IEnumerable <EntityBase> entities)
 {
     return(entities.Select(entity => _parser.Parse(entity)));
 }