public void EmptyDocumentTest() { elementPath = XmlParser.GetActiveElementStartPathAtIndex("", 0); expectedElementPath = new XmlElementPath(); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void Equality() { XmlElementPath newPath = new XmlElementPath(); newPath.Elements.Add(new QualifiedName("foo", "http://foo")); Assert.IsTrue(newPath.Equals(path), "Should be equal."); }
public void NotEqual() { XmlElementPath newPath = new XmlElementPath(); newPath.Elements.Add(new QualifiedName("Foo", "bar")); Assert.IsFalse(newPath.Equals(path), "Should not be equal."); }
public void NotEqual() { XmlElementPath newPath = new XmlElementPath(); newPath.AddElement(new QualifiedName("aaa", "a", "a")); newPath.AddElement(new QualifiedName("bbb", "b", "b")); Assert.IsFalse(newPath.Equals(path), "Should not be equal."); }
public void CompactPathItem() { XmlElementPath newPath = new XmlElementPath(); newPath.AddElement(new QualifiedName("bar", "http://bar", "b")); path.Compact(); Assert.IsTrue(newPath.Equals(path), "Should be equal."); }
public void SuccessTest4() { string text = "<bar xmlns='http://test.com'><foo xmlns='" + namespaceURI + "' ><"; elementPath = XmlParser.GetParentElementPath(text); expectedElementPath = new XmlElementPath(); expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void GetActiveElementStartPathForRootElement() { string text = "<foo xmlns='" + namespaceURI + "' "; elementPath = XmlParser.GetActiveElementStartPath(text, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void PathTest11() { string text = "<foo xmlns='" + namespaceURI + "'>"; elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, 2); expectedElementPath = new XmlElementPath(); expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void GetParentElementPathForRootElementAfterEmptyChildElementEnd() { string text = "<foo xmlns='" + namespaceURI + "' ><bar/><"; elementPath = XmlParser.GetParentElementPath(text); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void ElementPathsByNamespaceFoo() { XmlElementPathsByNamespace paths = new XmlElementPathsByNamespace(path); XmlElementPath fooPath = paths[0]; XmlElementPath expectedPath = new XmlElementPath(); expectedPath.AddElement(new QualifiedName("foo", "http://foo", "f")); Assert.IsTrue(expectedPath.Equals(fooPath)); }
public void ElementPathsByNamespaceBar() { XmlElementPathsByNamespace paths = new XmlElementPathsByNamespace(path); XmlElementPath barPath = paths[1]; XmlElementPath expectedPath = new XmlElementPath(); expectedPath.AddElement(new QualifiedName("bar", "http://bar", "b")); Assert.IsTrue(expectedPath.Equals(barPath)); }
public void PathTest4() { string text = "<x:foo xmlns:x='" + namespaceURI + "' "; elementPath = XmlParser.GetActiveElementStartPath(text, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI, "x")); Assert.IsTrue(expectedElementPath.Equals(elementPath), "Incorrect active element path."); }
public void GetActiveElementStartPathForChildElementWithNamespacePrefix() { string text = "<f:foo xmlns:f='" + namespaceURI + "' ><f:bar "; elementPath = XmlParser.GetActiveElementStartPath(text, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI, "f")); expectedElementPath.AddElement(new QualifiedName("bar", namespaceURI, "f")); Assert.IsTrue(expectedElementPath.Equals(elementPath), "Incorrect active element path."); }
public void PathTest10() { string text = "<foo xmlns='" + namespaceURI + "'><bar Id=\r\n</foo>"; elementPath = XmlParser.GetActiveElementStartPathAtIndex(text, text.IndexOf("Id=")); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); expectedElementPath.AddElement(new QualifiedName("bar", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void GetParentElementPathForTwoElementsInDifferentNamespaces() { string text = "<bar xmlns='http://test.com'><foo xmlns='" + namespaceURI + "' ><"; elementPath = XmlParser.GetParentElementPath(text); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("bar", "http://test.com")); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void PathWithTab() { string text = "<foo xmlns='" + namespaceURI + "'><bar"; string text2 = "\t</foo>"; elementPath = XmlParser.GetActiveElementStartPathAtIndex(text + text2, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.Elements.Add(new QualifiedName("foo", namespaceURI)); expectedElementPath.Elements.Add(new QualifiedName("bar", namespaceURI)); Assert.IsTrue(elementPath.Equals(expectedElementPath), "Incorrect active element path."); }
public void GetActiveElementStartPathWithTwoElementsInDifferentNamespaces() { string text = "<bar xmlns='http://bar'>\r\n" + "<foo xmlns='" + namespaceURI + "' "; elementPath = XmlParser.GetActiveElementStartPath(text, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("bar", "http://bar")); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); Assert.IsTrue(expectedElementPath.Equals(elementPath), "Incorrect active element path."); }
public void GetActiveElementStartPathWithTextIncludingChildElementAttributesOnDifferentLine() { string text = "<foo xmlns='" + namespaceURI + "'>\r\n" + "<y\r\n" + "Id = 'foo' "; elementPath = XmlParser.GetActiveElementStartPath(text, text.Length); expectedElementPath = new XmlElementPath(); expectedElementPath.AddElement(new QualifiedName("foo", namespaceURI)); expectedElementPath.AddElement(new QualifiedName("y", namespaceURI)); Assert.IsTrue(expectedElementPath.Equals(elementPath), "Incorrect active element path."); }
public void ChangeNamespaceForTwoElementsWithoutNamespaceModifiesAllItems() { XmlElementPath path = new XmlElementPath(); path.AddElement(new QualifiedName("root", String.Empty)); path.AddElement(new QualifiedName("child", String.Empty)); path.SetNamespaceForUnqualifiedNames("http://test"); XmlElementPath expectedPath = new XmlElementPath(); expectedPath.AddElement(new QualifiedName("root", "http://test")); expectedPath.AddElement(new QualifiedName("child", "http://test")); Assert.IsTrue(expectedPath.Equals(path)); }
public void ChangeNamespaceForTwoElementsWhereChildElementHasOwnNamespaceOnlyAffectsRootElement() { XmlElementPath path = new XmlElementPath(); path.AddElement(new QualifiedName("root", String.Empty)); path.AddElement(new QualifiedName("child", "has-namespace-already")); path.SetNamespaceForUnqualifiedNames("http://test"); XmlElementPath expectedPath = new XmlElementPath(); expectedPath.AddElement(new QualifiedName("root", "http://test")); expectedPath.AddElement(new QualifiedName("child", "has-namespace-already")); Assert.IsTrue(expectedPath.Equals(path)); }
public void Equality() { XmlElementPath newPath = new XmlElementPath(); Assert.IsTrue(newPath.Equals(path), "Should be equal."); }
public void EqualsItself() { Assert.IsTrue(path.Equals(path), "Should be equal."); }