-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Governorship conversion part I (#322) #minor
* Create Governorship.cs * Create GovernorshipTests.cs * Jobs * Create governorMappings.txt * new Jobs constructor * read jobs from save * Region to title mapping * Update commonItems.NET * Update World.cs * InitializeFromGovernorship * ImportImperatorGovernorship * Update Title.cs * Province mapping improvement * Update province_mappings.txt * LandedTitles.LinkCapitals * Governorship conversion polishing * Governorship loc fixes * PR tweaks * Fix governorship loc for PRY, SEL, MRY * PR tweak * Naming tweaks * New tests for TagTitleMapper * TitleCanBeMatchedFromGovernorship test * Remove unused field * LocBlockCanBeCopyConstructed test * CapitalsAreLinked test * Fix uodating from other title * Null checks * Remove redundant parentheses * Extract locak function * Move county holder caching out of OverWriteCountiesHistory * Reverse condition * Fix build
- Loading branch information
1 parent
8b8454c
commit 05eb136
Showing
20 changed files
with
969 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
ImperatorToCK3.UnitTests/Imperator/Jobs/GovernorshipTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using commonItems; | ||
using ImperatorToCK3.Imperator.Jobs; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.Imperator.Jobs { | ||
public class GovernorshipTests { | ||
[Fact] | ||
public void FieldsDefaultToCorrectValues() { | ||
var reader = new BufferedReader(string.Empty); | ||
var governorship = new Governorship(reader); | ||
Assert.Equal((ulong)0, governorship.CountryID); | ||
Assert.Equal((ulong)0, governorship.CharacterID); | ||
Assert.Equal(new Date(1, 1, 1), governorship.StartDate); | ||
Assert.True(string.IsNullOrEmpty(governorship.RegionName)); | ||
} | ||
[Fact] | ||
public void FieldsCanBeSet() { | ||
var reader = new BufferedReader( | ||
"who=589\n" + | ||
"character=25212\n" + | ||
"start_date=450.10.1\n" + | ||
"governorship = \"galatia_region\"" | ||
); | ||
var governorship = new Governorship(reader); | ||
Assert.Equal((ulong)589, governorship.CountryID); | ||
Assert.Equal((ulong)25212, governorship.CharacterID); | ||
Assert.Equal(new Date(450, 10, 1, AUC: true), governorship.StartDate); | ||
Assert.Equal("galatia_region", governorship.RegionName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.IO; | ||
using commonItems; | ||
using Xunit; | ||
|
||
namespace ImperatorToCK3.UnitTests.Imperator.Jobs { | ||
[Collection("Sequential")] | ||
[CollectionDefinition("Sequential", DisableParallelization = true)] | ||
public class JobsTests { | ||
[Fact] | ||
public void GovernorshipsDefaultToEmpty() { | ||
var jobs = new ImperatorToCK3.Imperator.Jobs.Jobs(); | ||
Assert.Empty(jobs.Governorships); | ||
} | ||
[Fact] | ||
public void GovernorshipsCanBeRead() { | ||
var reader = new BufferedReader( | ||
"province_job={who=1} province_job={who=2}" | ||
); | ||
var jobs = new ImperatorToCK3.Imperator.Jobs.Jobs(reader); | ||
Assert.Collection(jobs.Governorships, | ||
item1 => Assert.Equal((ulong)1, item1.CountryID), | ||
item2 => Assert.Equal((ulong)2, item2.CountryID) | ||
); | ||
} | ||
[Fact] | ||
public void IgnoredTokensAreLogged() { | ||
var output = new StringWriter(); | ||
Console.SetOut(output); | ||
|
||
var reader = new BufferedReader( | ||
"useless_job = {}" | ||
); | ||
_ = new ImperatorToCK3.Imperator.Jobs.Jobs(reader); | ||
|
||
Assert.Contains("Ignored Jobs tokens: useless_job", output.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.