diff --git a/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs b/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs index 69c980d2f..25d1f16e6 100644 --- a/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs +++ b/ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs @@ -2,6 +2,7 @@ using commonItems.Mods; using ImperatorToCK3.CK3.Titles; using ImperatorToCK3.Mappers.Region; +using System; using System.Collections.Generic; using System.IO; using Xunit; @@ -38,9 +39,11 @@ public void LoadingBrokenRegionWillThrowException() { const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenRegionWillThrowException"; var ck3Root = Path.Combine(ck3Path, "game"); var ck3ModFS = new ModFilesystem(ck3Root, new List()); - void action() => mapper.LoadRegions(ck3ModFS, landedTitles); - KeyNotFoundException exception = Assert.Throws(action); - Assert.Equal("Region's test_region2 region test_region does not exist!", exception.Message); + + var output = new StringWriter(); + Console.SetOut(output); + mapper.LoadRegions(ck3ModFS, landedTitles); + Assert.Contains("Region's test_region2 region test_region does not exist!", output.ToString()); } [Fact] public void LoadingBrokenDuchyWillThrowException() { @@ -53,9 +56,11 @@ public void LoadingBrokenDuchyWillThrowException() { const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenDuchyWillThrowException"; var ck3Root = Path.Combine(ck3Path, "game"); var ck3ModFS = new ModFilesystem(ck3Root, new List()); - void action() => mapper.LoadRegions(ck3ModFS, landedTitles); - KeyNotFoundException exception = Assert.Throws(action); - Assert.Equal("Region's test_region duchy d_aquitane does not exist!", exception.Message); + + var output = new StringWriter(); + Console.SetOut(output); + mapper.LoadRegions(ck3ModFS, landedTitles); + Assert.Contains("Region's test_region duchy d_aquitane does not exist!", output.ToString()); } [Fact] public void LoadingBrokenCountyWillThrowException() { @@ -68,9 +73,11 @@ public void LoadingBrokenCountyWillThrowException() { const string ck3Path = "TestFiles/regions/CK3RegionMapperTests/LoadingBrokenCountyWillThrowException"; var ck3Root = Path.Combine(ck3Path, "game"); var ck3ModFS = new ModFilesystem(ck3Root, new List()); - void Action() => mapper.LoadRegions(ck3ModFS, landedTitles); - KeyNotFoundException exception = Assert.Throws(Action); - Assert.Equal("Region's test_region county c_mers does not exist!", exception.Message); + + var output = new StringWriter(); + Console.SetOut(output); + mapper.LoadRegions(ck3ModFS, landedTitles); + Assert.Contains("Region's test_region county c_mers does not exist!", output.ToString()); } [Fact]