Пример #1
0
        public void HasNoElementsWhenGivenInvalidXml()
        {
            var vxmlPage = new VxmlPage("<vxml></garbage>");

            Assert.That(vxmlPage.Parse(), Is.EqualTo(false));
            Assert.That(vxmlPage.Elements.Count, Is.EqualTo(0));
        }
Пример #2
0
        public void HasNoElementsWhenGivenEmptyString()
        {
            var vxmlPage = new VxmlPage(string.Empty);

            Assert.That(vxmlPage.Parse(), Is.EqualTo(false));
            Assert.That(vxmlPage.Elements.Count, Is.EqualTo(0));
        }
Пример #3
0
        public void CanParseVxmlTag()
        {
            var vxmlPage = new VxmlPage(_vxml);

            vxmlPage.Parse();

            Assert.That(vxmlPage.XmlNamespace, Is.EqualTo("http://xmlnsurl"));
            Assert.That(vxmlPage.Version, Is.EqualTo("2.1"));
        }
Пример #4
0
        public void CanPrintTheVxmlAfterParsing()
        {
            var vxmlPage = new VxmlPage(_vxml);

            vxmlPage.Parse();

            var formattedVxml = "<vxml xmlns=\"http://xmlnsurl\" version=\"2.1\" >\n\t<property name=\"variableName\" value=\"variableValue\" />\n\t<property name=\"variableName1\" value=\"variableValue1\" />\n</vxml>";

            Assert.That(vxmlPage.Print(), Is.EqualTo(formattedVxml));
        }
Пример #5
0
        public void CanParseOutMultipleElements()
        {
            var vxmlPage = new VxmlPage(_vxml);

            vxmlPage.Parse();

            Assert.That(vxmlPage.Elements.Count, Is.EqualTo(2));
            Assert.That(vxmlPage.Elements[1].Name, Is.EqualTo("property"));
            Assert.That(vxmlPage.Elements[1].Attributes.Count, Is.EqualTo(2));
        }
Пример #6
0
        public void CanParseVxmlWithElementsThatContainElements()
        {
            var vxml     = "<vxml xmlns=\"http://xmlnsurl\" version=\"2.1\" ><catch event=\"connection.disconnect.hangup\"><goto next=\"nextUrl\" /></catch></vxml>";
            var vxmlPage = new VxmlPage(vxml);

            vxmlPage.Parse();

            Assert.That(vxmlPage.Elements.Count, Is.EqualTo(1));
            Assert.That(vxmlPage.Elements[0].Name, Is.EqualTo(VxmlElement.Catch.Name));
            Assert.That(vxmlPage.Elements[0].Attributes.Count, Is.EqualTo(1));
            Assert.That(vxmlPage.Elements[0].Elements[0].Name, Is.EqualTo(VxmlElement.GoTo.Name));
        }