Skip to content

Commit 7dfebb6

Browse files
Copilottinohager
andauthored
Add explicit ASCII-based int values to Alpha3Code enum (#65)
* Initial plan * Add explicit ASCII-based int values to Alpha3Code enum Co-authored-by: tinohager <8215186+tinohager@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tinohager <8215186+tinohager@users.noreply.github.com>
1 parent 892da98 commit 7dfebb6

File tree

2 files changed

+266
-251
lines changed

2 files changed

+266
-251
lines changed

src/Nager.Country.UnitTest/CountryTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,16 @@ public void GetCountries()
9797
}
9898
}
9999
}
100+
101+
[TestMethod]
102+
public void Alpha3CodeHasCorrectAsciiValue()
103+
{
104+
foreach (var alpha3Code in (Alpha3Code[])Enum.GetValues(typeof(Alpha3Code)))
105+
{
106+
var name = alpha3Code.ToString();
107+
var expectedValue = int.Parse(string.Concat(name.Select(c => ((int)c).ToString())));
108+
Assert.AreEqual(expectedValue, (int)alpha3Code, $"Alpha3Code.{name} has wrong int value");
109+
}
110+
}
100111
}
101112
}

0 commit comments

Comments
 (0)