Skip to content

Commit

Permalink
Merge branch 'master' into analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Aug 6, 2023
2 parents b3f584f + 1caa521 commit 7dfcd07
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions ImperatorToCK3.UnitTests/Mappers/Region/CK3RegionMapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Mod>());
void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(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() {
Expand All @@ -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<Mod>());
void action() => mapper.LoadRegions(ck3ModFS, landedTitles);
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(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() {
Expand All @@ -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<Mod>());
void Action() => mapper.LoadRegions(ck3ModFS, landedTitles);
KeyNotFoundException exception = Assert.Throws<KeyNotFoundException>(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]
Expand Down

0 comments on commit 7dfcd07

Please sign in to comment.