Skip to content

Commit

Permalink
Unit tests for TitleRankUtils.CharToTitleRank (#2305)
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Nov 10, 2024
1 parent b62c6c5 commit f3d2780
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ImperatorToCK3.UnitTests/CK3/Titles/TitleRankUtilsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using ImperatorToCK3.CK3.Titles;
using System;
using Xunit;

namespace ImperatorToCK3.UnitTests.CK3.Titles;

public class TitleRankUtilsTests {
[Theory]
[InlineData('e', TitleRank.empire)]
[InlineData('k', TitleRank.kingdom)]
[InlineData('d', TitleRank.duchy)]
[InlineData('c', TitleRank.county)]
[InlineData('b', TitleRank.barony)]
public void CharToTitleRankReturnsCorrectTitleRank(char c, TitleRank expectedRank) {
var rank = TitleRankUtils.CharToTitleRank(c);
Assert.Equal(expectedRank, rank);
}

[Fact]
public void CharToTitleRankThrowsOnUnknownRank() {
Assert.Throws<ArgumentOutOfRangeException>(() => TitleRankUtils.CharToTitleRank('x'));
}
}

0 comments on commit f3d2780

Please sign in to comment.