private bool DoesElementExist(string vxml, VxmlElement element) { using (var xmlReader = XmlReader.Create(new StringReader(vxml))) { return(xmlReader.ReadToFollowing(element.Name)); } }
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); } }
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); } }
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)); }
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)); }
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); }
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\" />")); }
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); }
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>")); }
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; }
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; }
private bool DoesElementExist(string vxml, VxmlElement element) { using (var xmlReader = XmlReader.Create(new StringReader(vxml))) { return xmlReader.ReadToFollowing(element.Name); } }
private static bool LineContains(string line, VxmlElement element) { return(line.Contains(element.Name)); }
private static void AddAttributesToElement(XmlReader xmlReader, VxmlElement element) { while (xmlReader.MoveToNextAttribute()) { element.Attributes.Add(CreateAttribute(xmlReader)); } }
private void AddElement(VxmlElement element) { if (element.Name != VxmlElement.Vxml.Name) { Elements.Add(element); } }
private static bool LineContains(string line, VxmlElement element) { return line.Contains(element.Name); }
public void ItHasAName() { var submit = new VxmlElement(VxmlElement.Submit); Assert.That("submit", Is.EqualTo(submit.Name)); }
public void CanPrintEmptyElement() { var submit = new VxmlElement(VxmlElement.Submit); Assert.That(submit.ToString(), Is.EqualTo("<submit />")); }