Skip to content

Commit 2a7f01f

Browse files
committed
Batch dependency catch-up.
NOTE: This doesn't include the current newest `Markdig` version 0.43.0, as this has introduced some rendering issues with pipe tables. - A fix made for "tables with leading paragraphs" results in *adding* a leading paragraph to tables which shouldn't have one. xoofx/markdig#905 Notable changes in the test project: - `MSTest.TestFramework` upgrades deprecated and removed the "ExpectedException" attribute, in favor of `Assert.Throws...()` test assertions. - It's also deprecated assertions on enumerable/collection Count values, in favor of countable assertion methods like `IsEmpty()` and `HasCount()`. - AND, its analyzer now throws an error if there's no explicit Parallelize setting.
1 parent 9268a4f commit 2a7f01f

File tree

8 files changed

+75
-54
lines changed

8 files changed

+75
-54
lines changed

GlogGenerator.Test/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
3+
[assembly:Parallelize]

GlogGenerator.Test/Data/PostDataTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public void TestToMarkdownAfterKeyChanges()
8282

8383
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
8484

85-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
86-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
85+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
86+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
8787

8888
var testPostData = PostData.MarkdownFromString(builder.GetMarkdownPipeline(), testPostFileText, testIndex);
8989
testIndex.ResolveReferences();

GlogGenerator.Test/Data/SiteDataIndexTests.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public void TestLoadContentMergedTags()
4545

4646
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
4747

48-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
49-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
48+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
49+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
5050

5151
var testTag = testIndex.GetTag("Sonic the Hedgehog");
5252
Assert.AreEqual("Sonic The Hedgehog", testTag.Name);
@@ -76,8 +76,8 @@ public void TestLoadContentReferenceConsistentAfterKeyChange()
7676

7777
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
7878

79-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
80-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
79+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
80+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
8181

8282
var testReference = testIndex.CreateReference<GameData>(testDataItem.Name, true);
8383
var testData = testIndex.GetData(testReference);
@@ -90,12 +90,12 @@ public void TestLoadContentReferenceConsistentAfterKeyChange()
9090
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
9191

9292
var errors = logger.GetLogs(LogLevel.Error);
93-
Assert.AreEqual(1, errors.Count);
93+
Assert.HasCount(1, errors);
9494

9595
var expectedMessage = $"Updated data index has a different key for GameData with data ID {testDataItem.GetUniqueIdString(mockIgdbCache)}: old key Some Game Name new key Corrected Game Name";
9696
Assert.AreEqual(expectedMessage, errors[0].Message);
9797

98-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
98+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
9999

100100
Assert.IsTrue(testReference.GetIsResolved());
101101

@@ -121,8 +121,8 @@ public void TestLoadContentUpdateKeyChanged()
121121

122122
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
123123

124-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
125-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
124+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
125+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
126126

127127
testIndex.CreateReference<PlatformData>(testPlatformOld.Abbreviation, true);
128128
testIndex.ResolveReferences();
@@ -134,12 +134,12 @@ public void TestLoadContentUpdateKeyChanged()
134134
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
135135

136136
var errors = logger.GetLogs(LogLevel.Error);
137-
Assert.AreEqual(1, errors.Count);
137+
Assert.HasCount(1, errors);
138138

139139
var expectedMessage = $"Updated data index has a different key for PlatformData with data ID {testPlatformOld.GetUniqueIdString(mockIgdbCache)}: old key {testPlatformOld.GetReferenceString(mockIgdbCache)} new key {testPlatformNew.GetReferenceString(mockIgdbCache)}";
140140
Assert.AreEqual(expectedMessage, errors[0].Message);
141141

142-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
142+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
143143
}
144144

145145
[TestMethod]
@@ -159,8 +159,8 @@ public void TestLoadContentUpdateMissingKey()
159159

160160
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
161161

162-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
163-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
162+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
163+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
164164

165165
testIndex.CreateReference<PlatformData>(testPlatformOld.Abbreviation, true);
166166
testIndex.ResolveReferences();
@@ -170,12 +170,12 @@ public void TestLoadContentUpdateMissingKey()
170170
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
171171

172172
var errors = logger.GetLogs(LogLevel.Error);
173-
Assert.AreEqual(1, errors.Count);
173+
Assert.HasCount(1, errors);
174174

175175
var expectedMessage = $"Updated data index is missing old PlatformData with data ID {testPlatformOld.GetUniqueIdString(mockIgdbCache)} and key {testPlatformOld.GetReferenceString(mockIgdbCache)}";
176176
Assert.AreEqual(expectedMessage, errors[0].Message);
177177

178-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
178+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
179179
}
180180

181181
[TestMethod]
@@ -195,8 +195,8 @@ public void TestLoadContentUpdateDataIdChanged()
195195

196196
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
197197

198-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
199-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
198+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
199+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
200200

201201
testIndex.CreateReference<PlatformData>(testPlatformOld.Abbreviation, true);
202202
testIndex.ResolveReferences();
@@ -207,10 +207,10 @@ public void TestLoadContentUpdateDataIdChanged()
207207

208208
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
209209

210-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
210+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
211211

212212
var warnings = logger.GetLogs(LogLevel.Warning);
213-
Assert.AreEqual(1, warnings.Count);
213+
Assert.HasCount(1, warnings);
214214

215215
var expectedMessage = $"Updated data index has a different data ID for PlatformData with key {testPlatformOld.GetReferenceString(mockIgdbCache)}: old data ID {testPlatformOld.GetUniqueIdString(mockIgdbCache)} new data ID {testPlatformNew.GetUniqueIdString(mockIgdbCache)}";
216216
Assert.AreEqual(expectedMessage, warnings[0].Message);
@@ -240,11 +240,11 @@ public void TestLoadContentUpdateNonContentReferenceChanged()
240240

241241
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
242242

243-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
244-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
243+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
244+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
245245

246246
var indexTags = testIndex.GetTags().Where(t => !IsDefaultTagData(t)).ToList();
247-
Assert.AreEqual(1, indexTags.Count);
247+
Assert.HasCount(1, indexTags);
248248
Assert.AreEqual(testCompany.Name, indexTags[0].Name);
249249

250250
var testCompanyUpdated = new IgdbCompany() { Id = testCompany.Id, Name = "The Updated Developer" };
@@ -253,11 +253,11 @@ public void TestLoadContentUpdateNonContentReferenceChanged()
253253

254254
testIndex.LoadContent(mockIgdbCache, builder.GetMarkdownPipeline(), includeDrafts: false);
255255

256-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Error).Count);
257-
Assert.AreEqual(0, logger.GetLogs(LogLevel.Warning).Count);
256+
Assert.IsEmpty(logger.GetLogs(LogLevel.Error));
257+
Assert.IsEmpty(logger.GetLogs(LogLevel.Warning));
258258

259259
indexTags = testIndex.GetTags().Where(t => !IsDefaultTagData(t)).ToList();
260-
Assert.AreEqual(1, indexTags.Count);
260+
Assert.HasCount(1, indexTags);
261261
Assert.AreEqual(testCompanyUpdated.Name, indexTags[0].Name);
262262
}
263263
}

GlogGenerator.Test/Data/SiteDataReferenceTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ public void TestResolvedReference()
3232
}
3333

3434
[TestMethod]
35-
[ExpectedException(typeof(ArgumentException))]
3635
public void TestResolveEmptyIdException()
3736
{
3837
var mockData = Substitute.For<IGlogReferenceable>();
3938
mockData.GetDataId().Returns(string.Empty);
4039

4140
var testReference = new SiteDataReference<IGlogReferenceable>("Test Tag");
42-
testReference.SetData(mockData);
41+
42+
Assert.ThrowsExactly<ArgumentException>(() =>
43+
{
44+
testReference.SetData(mockData);
45+
});
4346
}
4447
}
4548
}

GlogGenerator.Test/GlogGenerator.Test.csproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
18-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
19-
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
20-
<PackageReference Include="coverlet.collector" Version="3.2.0" />
21-
<PackageReference Include="NSubstitute" Version="5.1.0" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
18+
<PackageReference Include="MSTest.TestAdapter" Version="4.0.1" />
19+
<PackageReference Include="MSTest.TestFramework" Version="4.0.1" />
20+
<PackageReference Include="coverlet.collector" Version="6.0.4">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23+
</PackageReference>
24+
<PackageReference Include="NSubstitute" Version="5.3.0" />
2225
</ItemGroup>
2326

2427
<ItemGroup>

GlogGenerator.Test/MarkdownExtensions/GlogLinkTests.cs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,16 @@ public void TestGlogGameAutolink()
131131
}
132132

133133
[TestMethod]
134-
[ExpectedException(typeof(ArgumentException))]
135134
public void TestGlogGameAutolinkNotFound()
136135
{
137136
var builder = PrepareTestSiteBuilder();
138137

139138
var testText = "Remember <game:Test Game: With a Subtitle>?";
140139

141-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
140+
Assert.ThrowsExactly<ArgumentException>(() =>
141+
{
142+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
143+
});
142144
}
143145

144146
[TestMethod]
@@ -198,14 +200,16 @@ public void TestGlogGameLink()
198200
}
199201

200202
[TestMethod]
201-
[ExpectedException(typeof(ArgumentException))]
202203
public void TestGlogGameLinkNotFound()
203204
{
204205
var builder = PrepareTestSiteBuilder();
205206

206207
var testText = "Remember [that game with a stupid subtitle](game:Test Game: With a Subtitle)?";
207208

208-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
209+
Assert.ThrowsExactly<ArgumentException>(() =>
210+
{
211+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
212+
});
209213
}
210214

211215
[TestMethod]
@@ -266,14 +270,16 @@ public void TestGlogPlatformAutolink()
266270
}
267271

268272
[TestMethod]
269-
[ExpectedException(typeof(ArgumentException))]
270273
public void TestGlogPlatformAutolinkNotFound()
271274
{
272275
var builder = PrepareTestSiteBuilder();
273276

274277
var testText = "There were no good <platform:GS2> games";
275278

276-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
279+
Assert.ThrowsExactly<ArgumentException>(() =>
280+
{
281+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
282+
});
277283
}
278284

279285
[TestMethod]
@@ -336,14 +342,16 @@ public void TestGlogPlatformLink()
336342
}
337343

338344
[TestMethod]
339-
[ExpectedException(typeof(ArgumentException))]
340345
public void TestGlogPlatformLinkNotFound()
341346
{
342347
var builder = PrepareTestSiteBuilder();
343348

344349
var testText = "There were no good [GlogStation 2](platform:GS2) games";
345350

346-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
351+
Assert.ThrowsExactly<ArgumentException>(() =>
352+
{
353+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
354+
});
347355
}
348356

349357
[TestMethod]
@@ -402,14 +410,16 @@ public void TestGlogTagAutolink()
402410
}
403411

404412
[TestMethod]
405-
[ExpectedException(typeof(ArgumentException))]
406413
public void TestGlogTagAutolinkNotFound()
407414
{
408415
var builder = PrepareTestSiteBuilder();
409416

410417
var testText = "Waiting for <tag:Gamedev Inc.>'s next game";
411418

412-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
419+
Assert.ThrowsExactly<ArgumentException>(() =>
420+
{
421+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
422+
});
413423
}
414424

415425
[TestMethod]
@@ -460,14 +470,16 @@ public void TestGlogTagLink()
460470
}
461471

462472
[TestMethod]
463-
[ExpectedException(typeof(ArgumentException))]
464473
public void TestGlogTagLinkNotFound()
465474
{
466475
var builder = PrepareTestSiteBuilder();
467476

468477
var testText = "Waiting for [that studio](tag:Gamedev Inc.)'s next game";
469478

470-
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
479+
Assert.ThrowsExactly<ArgumentException>(() =>
480+
{
481+
Markdown.ToHtml(testText, builder.GetMarkdownPipeline());
482+
});
471483
}
472484

473485
[TestMethod]

GlogGenerator.Test/SmallSiteTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ public void TestBuildStaticSite()
4848
BuildStaticSite.Build(builder.GetSiteState(), staticSiteOutputBasePath);
4949

5050
var actualFilePaths = Directory.EnumerateFiles(staticSiteOutputBasePath, "*.*", SearchOption.AllDirectories).ToList();
51-
Assert.IsTrue(actualFilePaths.Count > 0);
51+
Assert.IsNotEmpty(actualFilePaths);
5252

5353
var outputExpected = Path.Combine(Directory.GetCurrentDirectory(), "TestFiles", "SmallSiteTest", "public-expected");
5454
var expectedFilePaths = Directory.EnumerateFiles(outputExpected, "*.*", SearchOption.AllDirectories).ToList();
55-
Assert.AreEqual(expectedFilePaths.Count, actualFilePaths.Count);
55+
Assert.HasCount(expectedFilePaths.Count, actualFilePaths);
5656

5757
foreach (var expectedFilePath in expectedFilePaths)
5858
{
5959
var relativeFilePath = expectedFilePath.Substring(outputExpected.Length + 1); // + 1 for the directory separator
6060
var actualFilePath = Path.Combine(staticSiteOutputBasePath, relativeFilePath);
6161

62-
Assert.IsTrue(actualFilePaths.Contains(actualFilePath));
62+
Assert.Contains(actualFilePath, actualFilePaths);
6363

6464
var expectedFileBytes = File.ReadAllBytes(expectedFilePath);
6565
var actualFileBytes = File.ReadAllBytes(actualFilePath);
@@ -105,18 +105,18 @@ public void TestBuildStaticSiteWithReloadedData()
105105
BuildStaticSite.Build(builder.GetSiteState(), staticSiteOutputBasePath);
106106

107107
var actualFilePaths = Directory.EnumerateFiles(staticSiteOutputBasePath, "*.*", SearchOption.AllDirectories).ToList();
108-
Assert.IsTrue(actualFilePaths.Count > 0);
108+
Assert.IsNotEmpty(actualFilePaths);
109109

110110
var outputExpected = Path.Combine(Directory.GetCurrentDirectory(), "TestFiles", "SmallSiteTest", "public-expected");
111111
var expectedFilePaths = Directory.EnumerateFiles(outputExpected, "*.*", SearchOption.AllDirectories).ToList();
112-
Assert.AreEqual(expectedFilePaths.Count, actualFilePaths.Count);
112+
Assert.HasCount(expectedFilePaths.Count, actualFilePaths);
113113

114114
foreach (var expectedFilePath in expectedFilePaths)
115115
{
116116
var relativeFilePath = expectedFilePath.Substring(outputExpected.Length + 1); // + 1 for the directory separator
117117
var actualFilePath = Path.Combine(staticSiteOutputBasePath, relativeFilePath);
118118

119-
Assert.IsTrue(actualFilePaths.Contains(actualFilePath));
119+
Assert.Contains(actualFilePath, actualFilePaths);
120120

121121
var expectedFileBytes = File.ReadAllBytes(expectedFilePath);
122122
var actualFileBytes = File.ReadAllBytes(actualFilePath);

GlogGenerator/GlogGenerator.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="Markdig" Version="0.33.0" />
27+
<PackageReference Include="Markdig" Version="0.42.0" />
2828
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
29-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
30-
<PackageReference Include="Scriban" Version="5.12.0" />
29+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
30+
<PackageReference Include="Scriban" Version="6.5.0" />
3131
<PackageReference Include="Tommy" Version="3.1.2" />
3232
</ItemGroup>
3333

0 commit comments

Comments
 (0)