2
using MonoDevelop.XmlEditor;
6
namespace MonoDevelop.XmlEditor.Tests.Paths
9
public class TwoElementPathTestFixture
12
QualifiedName firstQualifiedName;
13
QualifiedName secondQualifiedName;
18
path = new XmlElementPath();
19
firstQualifiedName = new QualifiedName("foo", "http://foo", "f");
20
path.Elements.Add(firstQualifiedName);
22
secondQualifiedName = new QualifiedName("bar", "http://bar", "b");
23
path.Elements.Add(secondQualifiedName);
27
public void HasTwoItems()
29
Assert.AreEqual(2, path.Elements.Count,
30
"Should have 2 elements.");
34
public void RemoveLastItem()
36
path.Elements.RemoveLast();
37
Assert.AreEqual(firstQualifiedName, path.Elements[0],
38
"Wrong item removed.");
42
public void LastPrefix()
44
Assert.AreEqual("b", path.Elements.LastPrefix, "Incorrect last prefix.");
48
public void LastPrefixAfterLastItemRemoved()
50
path.Elements.RemoveLast();
51
Assert.AreEqual("f", path.Elements.LastPrefix, "Incorrect last prefix.");
55
public void Equality()
57
XmlElementPath newPath = new XmlElementPath();
58
newPath.Elements.Add(new QualifiedName("foo", "http://foo", "f"));
59
newPath.Elements.Add(new QualifiedName("bar", "http://bar", "b"));
61
Assert.IsTrue(newPath.Equals(path), "Should be equal.");
65
public void NotEqual()
67
XmlElementPath newPath = new XmlElementPath();
68
newPath.Elements.Add(new QualifiedName("aaa", "a", "a"));
69
newPath.Elements.Add(new QualifiedName("bbb", "b", "b"));
71
Assert.IsFalse(newPath.Equals(path), "Should not be equal.");
75
public void CompactedPathItemCount()
78
Assert.AreEqual(1, path.Elements.Count, "Should only be one item.");
82
public void CompactPathItem()
84
XmlElementPath newPath = new XmlElementPath();
85
newPath.Elements.Add(new QualifiedName("bar", "http://bar", "b"));
88
Assert.IsTrue(newPath.Equals(path), "Should be equal.");