Skip to content

Commit e52a6b6

Browse files
adityapatwardhanvors
authored andcommitted
Fixed xpath queries in tests
1 parent 808df6f commit e52a6b6

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

test/Markdown.MAML.Test/EndToEnd/EndToEndTests.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public void ProduceNameAndSynopsis()
1818
## Synopsis
1919
This is Synopsis
2020
");
21-
string[] name = GetXmlContent(maml, "/helpItems/command:command/command:details/command:name");
21+
string[] name = GetXmlContent(maml, "/msh:helpItems/command:command/command:details/command:name");
2222
Assert.Equal(1, name.Length);
2323
Assert.Equal("Get-Foo", name[0]);
2424

25-
string[] synopsis = GetXmlContent(maml, "/helpItems/command:command/command:details/maml:description/maml:para");
25+
string[] synopsis = GetXmlContent(maml, "/msh:helpItems/command:command/command:details/maml:description/maml:para");
2626
Assert.Equal(1, synopsis.Length);
2727
Assert.Equal("This is Synopsis", synopsis[0]);
2828
}
@@ -43,7 +43,7 @@ public void ProduceMultilineDescription()
4343
And this is my last line.
4444
");
4545

46-
string[] description = GetXmlContent(maml, "/helpItems/command:command/maml:description/maml:para");
46+
string[] description = GetXmlContent(maml, "/msh:helpItems/command:command/maml:description/maml:para");
4747
Assert.Equal(3, description.Length);
4848
}
4949

@@ -59,11 +59,11 @@ This is Synopsis #hashtagNotAHeader.
5959
I'm description
6060
");
6161

62-
string[] description = GetXmlContent(maml, "/helpItems/command:command/maml:description/maml:para");
62+
string[] description = GetXmlContent(maml, "/msh:helpItems/command:command/maml:description/maml:para");
6363
Assert.Equal(1, description.Length);
6464
Assert.Equal("I'm description", description[0]);
6565

66-
string[] synopsis = GetXmlContent(maml, "/helpItems/command:command/command:details/maml:description/maml:para");
66+
string[] synopsis = GetXmlContent(maml, "/msh:helpItems/command:command/command:details/maml:description/maml:para");
6767
Assert.Equal(1, synopsis.Length);
6868
Assert.Equal("This is Synopsis #hashtagNotAHeader.", synopsis[0]);
6969
}
@@ -82,12 +82,12 @@ public void CanUseRelativeLinksInRelatedLinksSection()
8282
[bar](bar://bar.md)
8383
");
8484

85-
string[] linkText = GetXmlContent(maml, "/helpItems/command:command/command:relatedLinks/maml:navigationLink/maml:linkText");
85+
string[] linkText = GetXmlContent(maml, "/msh:helpItems/command:command/command:relatedLinks/maml:navigationLink/maml:linkText");
8686
Assert.Equal(2, linkText.Length);
8787
Assert.Equal("foo", linkText[0]);
8888
Assert.Equal("bar", linkText[1]);
8989

90-
string[] linkUri = GetXmlContent(maml, "/helpItems/command:command/command:relatedLinks/maml:navigationLink/maml:uri");
90+
string[] linkUri = GetXmlContent(maml, "/msh:helpItems/command:command/command:relatedLinks/maml:navigationLink/maml:uri");
9191
Assert.Equal(2, linkUri.Length);
9292
Assert.Equal("", linkUri[0]); // empty, because foo.md is not a valid URI and help system will be unhappy.
9393
Assert.Equal("bar://bar.md", linkUri[1]); // bar://bar.md is a valid URI
@@ -340,7 +340,7 @@ You can also use the PSSnapin property of the object that the Get-Command cmdlet
340340
[about_PSSnapins]()
341341
342342
");
343-
string[] examples = GetXmlContent(maml, "/helpItems/command:command/command:examples/command:example/dev:code");
343+
string[] examples = GetXmlContent(maml, "msh:helpItems/command:command/command:examples/command:example/dev:code");
344344
Assert.Equal(5 + 3, examples.Length);
345345
}
346346

@@ -358,6 +358,7 @@ public static string[] GetXmlContent(string xml, string xpath)
358358
xmlns.AddNamespace("maml", "http://schemas.microsoft.com/maml/2004/10");
359359
xmlns.AddNamespace("dev", "http://schemas.microsoft.com/maml/dev/2004/10");
360360
xmlns.AddNamespace("MSHelp", "http://msdn.microsoft.com/mshelp");
361+
xmlns.AddNamespace("msh", "http://msh");
361362

362363
XPathNodeIterator iterator = nav.Select(xpath, xmlns);
363364
foreach (var i in iterator)

test/Markdown.MAML.Test/Renderer/MamlRendererTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ public void RendererProduceNameAndSynopsis()
6666

6767
string maml = renderer.MamlModelToString(new [] {command});
6868

69-
string[] name = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:details/command:name");
69+
string[] name = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:details/command:name");
7070
Assert.Equal(1, name.Length);
7171
Assert.Equal("Get-Foo", name[0]);
7272

73-
string[] synopsis = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:details/maml:description/maml:para");
73+
string[] synopsis = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:details/maml:description/maml:para");
7474
Assert.Equal(1, synopsis.Length);
7575
Assert.Equal("This is the synopsis", synopsis[0]);
7676
}
@@ -108,16 +108,16 @@ public void RendererProduceSyntaxAndParameter()
108108

109109
string maml = renderer.MamlModelToString(new[] { command });
110110

111-
string[] syntaxItemName = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:syntax/command:syntaxItem/maml:name");
111+
string[] syntaxItemName = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:syntax/command:syntaxItem/maml:name");
112112
Assert.Equal(1, syntaxItemName.Length);
113113
Assert.Equal("Get-Foo", syntaxItemName[0]);
114114

115-
string[] nameSyntax = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:syntax/command:syntaxItem/command:parameter/maml:name");
115+
string[] nameSyntax = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:syntax/command:syntaxItem/command:parameter/maml:name");
116116
Assert.Equal(2, nameSyntax.Length);
117117
Assert.Equal("Param1", nameSyntax[0]);
118118
Assert.Equal("Param2", nameSyntax[1]);
119119

120-
string[] nameParam = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:parameters/command:parameter/maml:name");
120+
string[] nameParam = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:parameters/command:parameter/maml:name");
121121
Assert.Equal(2, nameParam.Length);
122122
Assert.Equal("Param1", nameParam[0]);
123123
Assert.Equal("Param2", nameParam[1]);
@@ -135,7 +135,7 @@ public void RendererProduceEscapeXmlSpecialChars()
135135

136136
string maml = renderer.MamlModelToString(new[] { command });
137137

138-
string[] synopsis = EndToEndTests.GetXmlContent(maml, "/helpItems/command:command/command:details/maml:description/maml:para");
138+
string[] synopsis = EndToEndTests.GetXmlContent(maml, "/msh:helpItems/command:command/command:details/maml:description/maml:para");
139139
Assert.Equal(1, synopsis.Length);
140140
Assert.Equal(synopsis[0], command.Synopsis);
141141
}

0 commit comments

Comments
 (0)