Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests #1463

Merged
merged 1 commit into from
Aug 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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