Skip to content

Commit 7dfcd07

Browse files
authored
Merge branch 'master' into analyzer
2 parents b3f584f + 1caa521 commit 7dfcd07

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using commonItems.Mods;
33
using ImperatorToCK3.CK3.Titles;
44
using ImperatorToCK3.Mappers.Region;
5+
using System;
56
using System.Collections.Generic;
67
using System.IO;
78
using Xunit;
@@ -38,9 +39,11 @@ public void LoadingBrokenRegionWillThrowException() {
3839
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenRegionWillThrowException";
3940
var ck3Root = Path.Combine(ck3Path, "game");
4041
var ck3ModFS = new ModFilesystem(ck3Root, new List<Mod>());
41-
void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
42-
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(action);
43-
Assert.Equal("Region's test_region2 region test_region does not exist!", exception.Message);
42+
43+
var output = new StringWriter();
44+
Console.SetOut(output);
45+
mapper.LoadRegions(ck3ModFS, landedTitles);
46+
Assert.Contains("Region's test_region2 region test_region does not exist!", output.ToString());
4447
}
4548
[Fact]
4649
public void LoadingBrokenDuchyWillThrowException() {
@@ -53,9 +56,11 @@ public void LoadingBrokenDuchyWillThrowException() {
5356
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenDuchyWillThrowException";
5457
var ck3Root = Path.Combine(ck3Path, "game");
5558
var ck3ModFS = new ModFilesystem(ck3Root, new List<Mod>());
56-
void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
57-
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(action);
58-
Assert.Equal("Region's test_region duchy d_aquitane does not exist!", exception.Message);
59+
60+
var output = new StringWriter();
61+
Console.SetOut(output);
62+
mapper.LoadRegions(ck3ModFS, landedTitles);
63+
Assert.Contains("Region's test_region duchy d_aquitane does not exist!", output.ToString());
5964
}
6065
[Fact]
6166
public void LoadingBrokenCountyWillThrowException() {
@@ -68,9 +73,11 @@ public void LoadingBrokenCountyWillThrowException() {
6873
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenCountyWillThrowException";
6974
var ck3Root = Path.Combine(ck3Path, "game");
7075
var ck3ModFS = new ModFilesystem(ck3Root, new List<Mod>());
71-
void Action() => mapper.LoadRegions(ck3ModFS, landedTitles);
72-
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(Action);
73-
Assert.Equal("Region's test_region county c_mers does not exist!", exception.Message);
76+
77+
var output = new StringWriter();
78+
Console.SetOut(output);
79+
mapper.LoadRegions(ck3ModFS, landedTitles);
80+
Assert.Contains("Region's test_region county c_mers does not exist!", output.ToString());
7481
}
7582

7683
[Fact]

0 commit comments

Comments
 (0)