public void StepForElementIncludesNamespace() { LocationStep step = new LocationStep("Element"); step.NodeTest.Namespace = "ns0"; Assert.AreEqual("ns0:Element", step.ToString(false)); }
public void StepForAttributeDoesntIncludeNamespace() { LocationStep step = new LocationStep("@attr"); step.NodeTest.Namespace = "ns0"; Assert.AreEqual("@attr", step.ToString(false)); }
public void Clone() { LocationStep step1 = new LocationStep("a"); LocationStep step2 = (LocationStep)step1.Clone(); Assert.AreNotSame(step1, step2); Assert.AreEqual(step1.ToString(true), step2.ToString(true)); }
public void CreateLocationStep_2() { LocationStep step = new LocationStep("root"); Assert.AreEqual(0, step.Predicates.Count); Assert.AreEqual("root", step.NodeTest.ToString()); Assert.AreEqual(PrincipalNodeTypes.Element, step.AxisSpecifier.NodeType); Assert.AreEqual(AxisSpecifier.Child, step.AxisSpecifier); Assert.IsFalse(step.IsAttribute); Assert.AreEqual("root", step.BaseXPath); Assert.AreEqual("child::root", step.ToString(true)); }
public void CreateLocationStep_1() { LocationStep step = new LocationStep("child::a:b[@c=d]"); Assert.AreEqual(1, step.Predicates.Count); Assert.AreEqual("[@c='d']", step.Predicates[0].ExpandedExpression); Assert.AreEqual("a:b", step.NodeTest.ToString()); Assert.AreEqual(AxisSpecifier.Child, step.AxisSpecifier); Assert.AreEqual(PrincipalNodeTypes.Element, step.AxisSpecifier.NodeType); Assert.IsFalse(step.IsAttribute); Assert.AreEqual("a:b", step.BaseXPath); Assert.AreEqual("a:b[@c='d']", step.ToString(false)); }