Esempio n. 1
0
 private bool DoesElementExist(string vxml, VxmlElement element)
 {
     using (var xmlReader = XmlReader.Create(new StringReader(vxml)))
     {
         return(xmlReader.ReadToFollowing(element.Name));
     }
 }
Esempio n. 2
0
 public static void ItemsInList(List<string> list, VxmlElement element, VxmlAttribute attribute, ConsoleColor color)
 {
     var count = 0;
     foreach (var item in list)
     {
         Log.Print(string.Format("{3} | {0}-{1}: '{2}'", element, attribute, item, ++count), color);
     }
 }
Esempio n. 3
0
        public static void ItemsInList(List <string> list, VxmlElement element, VxmlAttribute attribute, ConsoleColor color)
        {
            var count = 0;

            foreach (var item in list)
            {
                Log.Print(string.Format("{3} | {0}-{1}: '{2}'", element, attribute, item, ++count), color);
            }
        }
Esempio n. 4
0
        public void CanHaveListOfSubElements()
        {
            var noinput = new VxmlElement(VxmlElement.NoInput);

            noinput.Elements = new List <VxmlElement>
            {
                new VxmlElement(VxmlElement.Submit)
            };
            Assert.That(noinput.Elements.Count, Is.EqualTo(1));
            Assert.That(noinput.GetElement(VxmlElement.Submit).Name, Is.EqualTo(VxmlElement.Submit.Name));
        }
Esempio n. 5
0
        public void ItHasAListOfVxmlAttributes()
        {
            var submit     = new VxmlElement(VxmlElement.Submit);
            var attributes = new List <VxmlAttribute>
            {
                new VxmlAttribute("next", "NextUrlToGoTo"),
                new VxmlAttribute("method", "get"),
                new VxmlAttribute("namelist", "contactNumber lastResult")
            };

            submit.Attributes = attributes;
            Assert.That(3, Is.EqualTo(submit.Attributes.Count));
            Assert.That("next", Is.EqualTo(submit.GetAttribute(VxmlAttribute.Next).AttributeName));
        }
Esempio n. 6
0
        private List <string> GetAttributeFromAllElements(string vxml, VxmlElement element, VxmlAttribute attribute)
        {
            var options = new List <string>();

            using (var xmlReader = XmlReader.Create(new StringReader(vxml)))
            {
                while (xmlReader.ReadToFollowing(element.Name))
                {
                    var attributeText = xmlReader.GetAttribute(attribute.AttributeName);
                    options.Add(attributeText);
                }
            }
            return(options);
        }
Esempio n. 7
0
        public void CanPrintElementWithAttributes()
        {
            var submit = new VxmlElement(VxmlElement.Submit)
            {
                Attributes = new List <VxmlAttribute>
                {
                    new VxmlAttribute("next", "newUrl"),
                    new VxmlAttribute("method", "get"),
                    new VxmlAttribute("namelist", "contactNumber lastResult")
                }
            };

            Assert.That(submit.ToString(), Is.EqualTo("<submit next=\"newUrl\" method=\"get\" namelist=\"contactNumber lastResult\" />"));
        }
Esempio n. 8
0
        private string FindNextPage(string vxml, VxmlElement parentElement, VxmlAttribute attribute)
        {
            var attributeText = string.Empty;

            using (var stringReader = new StringReader(vxml))
                using (var xmlReader = XmlReader.Create(stringReader))
                {
                    do
                    {
                        if (xmlReader.ReadToFollowing(parentElement.Name))
                        {
                            attributeText = xmlReader.GetAttribute(attribute.AttributeName);
                        }
                    } while (!attributeText.Contains("hangup"));

                    if (xmlReader.ReadToDescendant(VxmlElement.GoTo.Name))
                    {
                        attributeText = xmlReader.GetAttribute(VxmlAttribute.Next.AttributeName);
                    }
                }
            return(attributeText);
        }
Esempio n. 9
0
        public void CanPrintElementWithSubElements()
        {
            var nomatch = new VxmlElement(VxmlElement.NoMatch)
            {
                Attributes = new List <VxmlAttribute>
                {
                    new VxmlAttribute("attName", "attValue")
                },
                Elements = new List <VxmlElement>
                {
                    new VxmlElement(VxmlElement.Submit)
                    {
                        Attributes = new List <VxmlAttribute>
                        {
                            new VxmlAttribute("next", "newUrl")
                        }
                    }
                }
            };

            Assert.That(nomatch.ToString(), Is.EqualTo("<nomatch attName=\"attValue\" />\n\t<submit next=\"newUrl\" />\n</nomatch>"));
        }
Esempio n. 10
0
        private List<string> GetAttributeFromAllElements(string vxml, VxmlElement element, VxmlAttribute attribute)
        {
            var options = new List<string>();

            using (var xmlReader = XmlReader.Create(new StringReader(vxml)))
            {
                while (xmlReader.ReadToFollowing(element.Name))
                {
                    var attributeText = xmlReader.GetAttribute(attribute.AttributeName);
                    options.Add(attributeText);
                }
            }
            return options;
        }
Esempio n. 11
0
        private string FindNextPage(string vxml, VxmlElement parentElement, VxmlAttribute attribute)
        {
            var attributeText = string.Empty;
            using (var stringReader = new StringReader(vxml))
            using (var xmlReader = XmlReader.Create(stringReader))
            {
                do
                {
                    if (xmlReader.ReadToFollowing(parentElement.Name))
                    {
                        attributeText = xmlReader.GetAttribute(attribute.AttributeName);
                    }

                } while (!attributeText.Contains("hangup"));

                if (xmlReader.ReadToDescendant(VxmlElement.GoTo.Name))
                {
                    attributeText = xmlReader.GetAttribute(VxmlAttribute.Next.AttributeName);
                }
            }
            return attributeText;
        }
Esempio n. 12
0
 private bool DoesElementExist(string vxml, VxmlElement element)
 {
     using (var xmlReader = XmlReader.Create(new StringReader(vxml)))
     {
         return xmlReader.ReadToFollowing(element.Name);
     }
 }
Esempio n. 13
0
 private static bool LineContains(string line, VxmlElement element)
 {
     return(line.Contains(element.Name));
 }
Esempio n. 14
0
 private static void AddAttributesToElement(XmlReader xmlReader, VxmlElement element)
 {
     while (xmlReader.MoveToNextAttribute())
     {
         element.Attributes.Add(CreateAttribute(xmlReader));
     }
 }
Esempio n. 15
0
 private void AddElement(VxmlElement element)
 {
     if (element.Name != VxmlElement.Vxml.Name)
     {
         Elements.Add(element);
     }
 }
Esempio n. 16
0
 private static bool LineContains(string line, VxmlElement element)
 {
     return line.Contains(element.Name);
 }
Esempio n. 17
0
        public void ItHasAName()
        {
            var submit = new VxmlElement(VxmlElement.Submit);

            Assert.That("submit", Is.EqualTo(submit.Name));
        }
Esempio n. 18
0
        public void CanPrintEmptyElement()
        {
            var submit = new VxmlElement(VxmlElement.Submit);

            Assert.That(submit.ToString(), Is.EqualTo("<submit />"));
        }