-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathMarkdownXamarinFormsTests.cs
More file actions
244 lines (204 loc) · 5.93 KB
/
MarkdownXamarinFormsTests.cs
File metadata and controls
244 lines (204 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using System.Threading.Tasks;
using Waher.Content.Emoji.Emoji1;
using Waher.Content.Markdown.Xamarin;
using Waher.Content.Xml;
using Waher.Runtime.Console;
using Waher.Runtime.IO;
namespace Waher.Content.Markdown.Test
{
[TestClass]
public class MarkdownXamarinFormsTests
{
private static async Task DoTest(string MarkdownFileName, string XamarinFormsFileName)
{
string Markdown = await Files.ReadAllTextAsync("Markdown/Syntax/" + MarkdownFileName);
string ExpectedText = await Files.ReadAllTextAsync("XF/" + XamarinFormsFileName);
ExpectedText = ExpectedText.Replace("
\r", "
");
Emoji1LocalFiles Emoji1LocalFiles = new(Emoji1SourceFileType.Svg, 24, 24, "/emoji1/%FILENAME%", Path.Combine("Graphics", "Emoji1.zip"), "Graphics");
MarkdownSettings Settings = new(Emoji1LocalFiles, true, [])
{
HttpxProxy = "/HttpxProxy/%URL%"
};
Assert.IsTrue(Emoji1LocalFiles.WaitUntilInitialized(60000));
MarkdownDocument Doc = await MarkdownDocument.CreateAsync(Markdown, Settings);
string GeneratedXaml = await Doc.GenerateXamarinForms(XML.WriterSettings(true, true));
ConsoleOut.WriteLine(GeneratedXaml);
ConsoleOut.WriteLine();
ConsoleOut.WriteLine();
ConsoleOut.WriteLine();
MarkdownHtmlTests.AssertEqual(ExpectedText, GeneratedXaml, "Generated Xamarin.Forms XAML does not match expected XAML.");
}
[TestMethod]
public async Task Test_01_Paragraphs()
{
await DoTest("Test_01_Paragraphs.md", "Test_01_Paragraphs.xml");
}
[TestMethod]
public async Task Test_02_Links()
{
await DoTest("Test_02_Links.md", "Test_02_Links.xml");
}
[TestMethod]
public async Task Test_03_TextFormatting()
{
await DoTest("Test_03_TextFormatting.md", "Test_03_TextFormatting.xml");
}
[TestMethod]
public async Task Test_04_Multimedia()
{
await DoTest("Test_04_Multimedia.md", "Test_04_Multimedia.xml");
}
[TestMethod]
public async Task Test_05_HTML()
{
await DoTest("Test_05_HTML.md", "Test_05_HTML.xml");
}
[TestMethod]
public async Task Test_06_CodeBlocks()
{
await DoTest("Test_06_CodeBlocks.md", "Test_06_CodeBlocks.xml");
}
[TestMethod]
public async Task Test_07_BlockQuotes()
{
await DoTest("Test_07_BlockQuotes.md", "Test_07_BlockQuotes.xml");
}
[TestMethod]
public async Task Test_08_Headers()
{
await DoTest("Test_08_Headers.md", "Test_08_Headers.xml");
}
[TestMethod]
public async Task Test_09_UnorderedLists()
{
await DoTest("Test_09_UnorderedLists.md", "Test_09_UnorderedLists.xml");
}
[TestMethod]
public async Task Test_10_LazyOrderedLists()
{
await DoTest("Test_10_LazyOrderedLists.md", "Test_10_LazyOrderedLists.xml");
}
[TestMethod]
public async Task Test_11_OrderedLists()
{
await DoTest("Test_11_OrderedLists.md", "Test_11_OrderedLists.xml");
}
[TestMethod]
public async Task Test_12_Typography()
{
await DoTest("Test_12_Typography.md", "Test_12_Typography.xml");
}
[TestMethod]
public async Task Test_13_Tables()
{
await DoTest("Test_13_Tables.md", "Test_13_Tables.xml");
}
[TestMethod]
public async Task Test_14_HorizontalRules()
{
await DoTest("Test_14_HorizontalRules.md", "Test_14_HorizontalRules.xml");
}
[TestMethod]
public async Task Test_15_DefinitionLists()
{
await DoTest("Test_15_DefinitionLists.md", "Test_15_DefinitionLists.xml");
}
[TestMethod]
public async Task Test_16_MetaData()
{
await DoTest("Test_16_MetaData.md", "Test_16_MetaData.xml");
}
[TestMethod]
public async Task Test_17_Footnotes()
{
await DoTest("Test_17_Footnotes.md", "Test_17_Footnotes.xml");
}
[TestMethod]
public async Task Test_18_Emojis()
{
await DoTest("Test_18_Emojis.md", "Test_18_Emojis.xml");
}
[TestMethod]
public async Task Test_19_Sections()
{
await DoTest("Test_19_Sections.md", "Test_19_Sections.xml");
}
[TestMethod]
public async Task Test_20_Script()
{
await DoTest("Test_20_Script.md", "Test_20_Script.xml");
}
[TestMethod]
public async Task Test_21_Httpx()
{
await DoTest("Test_21_Httpx.md", "Test_21_Httpx.xml");
}
[TestMethod]
public async Task Test_22_TaskLists()
{
await DoTest("Test_22_TaskLists.md", "Test_22_TaskLists.xml");
}
[TestMethod]
public async Task Test_23_Superscript()
{
await DoTest("Test_23_Superscript.md", "Test_23_Superscript.xml");
}
[TestMethod]
public async Task Test_24_Subscript()
{
await DoTest("Test_24_Subscript.md", "Test_24_Subscript.xml");
}
[TestMethod]
public async Task Test_25_HashTags()
{
await DoTest("Test_25_HashTags.md", "Test_25_HashTags.xml");
}
[TestMethod]
public async Task Test_26_Comments()
{
await DoTest("Test_26_Comments.md", "Test_26_Comments.xml");
}
[TestMethod]
public async Task Test_27_Contract()
{
await DoTest("Test_27_Contract.md", "Test_27_Contract.xml");
}
[TestMethod]
public async Task Test_28_Nesting()
{
await DoTest("Test_28_Nesting.md", "Test_28_Nesting.xml");
}
[TestMethod]
public async Task Test_29_Justification()
{
await DoTest("Test_29_Justification.md", "Test_29_Justification.xml");
}
[TestMethod]
public async Task Test_30_Incomplete()
{
await DoTest("Test_30_Incomplete.md", "Test_30_Incomplete.xml");
}
[TestMethod]
public async Task Test_31_Justification2()
{
await DoTest("Test_31_Justification2.md", "Test_31_Justification2.xml");
}
[TestMethod]
public async Task Test_32_TablesAndNotes()
{
await DoTest("Test_32_TablesAndNotes.md", "Test_32_TablesAndNotes.xml");
}
[TestMethod]
public async Task Test_33_SingleNoHeaderTable()
{
await DoTest("Test_33_SingleNoHeaderTable.md", "Test_33_SingleNoHeaderTable.xml");
}
[TestMethod]
public async Task Test_34_SpecifiedViewportHeader()
{
await DoTest("Test_34_SpecifiedViewportHeader.md", "Test_34_SpecifiedViewportHeader.xml");
}
}
}