2
2
using commonItems . Mods ;
3
3
using ImperatorToCK3 . CK3 . Titles ;
4
4
using ImperatorToCK3 . Mappers . Region ;
5
+ using System ;
5
6
using System . Collections . Generic ;
6
7
using System . IO ;
7
8
using Xunit ;
@@ -38,9 +39,11 @@ public void LoadingBrokenRegionWillThrowException() {
38
39
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenRegionWillThrowException" ;
39
40
var ck3Root = Path . Combine ( ck3Path , "game" ) ;
40
41
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 ( ) ) ;
44
47
}
45
48
[ Fact ]
46
49
public void LoadingBrokenDuchyWillThrowException ( ) {
@@ -53,9 +56,11 @@ public void LoadingBrokenDuchyWillThrowException() {
53
56
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenDuchyWillThrowException" ;
54
57
var ck3Root = Path . Combine ( ck3Path , "game" ) ;
55
58
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 ( ) ) ;
59
64
}
60
65
[ Fact ]
61
66
public void LoadingBrokenCountyWillThrowException ( ) {
@@ -68,9 +73,11 @@ public void LoadingBrokenCountyWillThrowException() {
68
73
const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenCountyWillThrowException" ;
69
74
var ck3Root = Path . Combine ( ck3Path , "game" ) ;
70
75
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 ( ) ) ;
74
81
}
75
82
76
83
[ Fact ]
0 commit comments