Skip to content

Commit 7fb0fe3

Browse files
committed
Use test files instead of live files. Add moved case.
1 parent 41321a3 commit 7fb0fe3

11 files changed

Lines changed: 29 additions & 9 deletions

File tree

converter/tests/DocToStaticPagesTransformerTests.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
using OriginLab.DocumentGeneration.Templates;
2-
3-
namespace OriginLab.DocumentGeneration.Tests;
1+
namespace OriginLab.DocumentGeneration.Tests;
42

53
public class DocToStaticPagesTransformerTests
64
{
75
[Theory]
8-
[InlineData("./GettingStarted/Category/Origin_9.1_Getting_Started_Booklet.html", "en", "/user-guide/", "User Guide")]
9-
[InlineData("./GettingStarted/Category/Origin_9.1_Getting_Started_Booklet.html", "de", "/user-guide/de/", "User Guide")]
10-
public async Task HrefShouldResolveCorrectly(string href, string language, string expectedUrl, string expectedTitle)
6+
[InlineData("./A/Category/App(App).html", "app", "en", "/app/", "Apps")]
7+
[InlineData("./A/Category/App(App).html", "app", "de", "/app/de/", "Apps")]
8+
[InlineData("./A/App/A.html", "app", "en", "/app/a/", "App A")]
9+
[InlineData("./A/App/B.html", "app", "de", "/app/b/de/", "App B")]
10+
[InlineData("./A/App/B_Script.html", "app", "de", "/build/b-scripts/de/", "B Scripts (Moved from App)")]
11+
public async Task HrefShouldResolveCorrectly(string href, string book, string language, string expectedUrl, string expectedTitle)
1112
{
12-
var bookDir = Path.GetFullPath("../../../index", Template.WebRootPath);
13+
var bookDir = Path.GetFullPath("../../../../converter/tests/books/" + book, AppContext.BaseDirectory);
1314
var args = new DocToStaticPagesTransformerArgs
1415
{
1516
BookUrlName = "",
16-
BooksXmlFolder = Path.GetFullPath("../../../books", Template.WebRootPath),
17+
BooksXmlFolder = Path.GetFullPath("../xml", bookDir),
1718
SourceFolder = bookDir,
18-
OutputFolder = Path.GetFullPath("../../../artifacts/tests/public_html", Template.WebRootPath),
19+
OutputFolder = Path.GetFullPath("../../../../artifacts/tests/public_html" + book, AppContext.BaseDirectory),
1920
};
2021
var transformer = new FakeDocToStaticPagesTransformer(args, new ProblemRecorder(args));
2122

converter/tests/books/app/en/A/App/A.html

Whitespace-only changes.

converter/tests/books/app/en/A/App/B.html

Whitespace-only changes.

converter/tests/books/app/en/A/App/C.html

Whitespace-only changes.

converter/tests/books/app/en/A/Category/App(App).html

Whitespace-only changes.

converter/tests/books/builder/en/B/Builder/B_Scripts.html

Whitespace-only changes.

converter/tests/books/builder/en/B/Builder/C_Scripts.html

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


converter/tests/books/xml/A.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<book wiki="howto">
3+
<page title="Apps" file="Category/App(App).html" url="App" src="Category:App(App)">
4+
<page title="App A" file="App/A.html" url="App/A" src="App:A"/>
5+
<page title="App B" file="App/B.html" url="App/B" src="App:B"/>
6+
<page title="App C" file="App/C.html" url="App/C" src="App:C"/>
7+
</page>
8+
</book>

converter/tests/books/xml/B.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<book wiki="ocwiki">
3+
<page title="Builder" file="Category/Builder.html" url="Builder" src="Category:Builder">
4+
<page title="B Scripts (Moved from App)" file="Builder/B_Scripts.html" url="Build/B-Scripts" src="Builder:B_Scripts"/>
5+
<page title="C Scripts" file="Builder/C_Scripts.html" url="Build/C-Scripts" src="Builder:C_Scripts"/>
6+
</page>
7+
</book>

0 commit comments

Comments
 (0)