Mark small countries on the map, fit latest catches table, show missing host
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6e2ff3f7ee
commit
31cef44bf3
15 files changed
+475
-27
No files matched your search
@@ -0,0 +1,52 @@
|
||||
using Flypaper.Web.Components.Pages.Dashboard;
|
||||
using Shouldly;
|
||||
|
||||
namespace Flypaper.Tests.Web;
|
||||
|
||||
public sealed class WorldMapDataTests
|
||||
{
|
||||
private static readonly string[] Iso3166Alpha2 =
|
||||
"""
|
||||
AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ
|
||||
CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR
|
||||
GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO
|
||||
JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR
|
||||
MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO
|
||||
RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV
|
||||
TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW
|
||||
""".Split((char[])[' ', '\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
private readonly WorldMapData _map = WorldMapData.Instance;
|
||||
|
||||
[Fact]
|
||||
public void Lists_all_249_iso_codes() => Iso3166Alpha2.Distinct().Count().ShouldBe(249);
|
||||
|
||||
[Fact]
|
||||
public void Every_iso_country_has_a_polygon_or_a_marker()
|
||||
{
|
||||
var drawn = _map.Countries.Select(c => c.Code).OfType<string>().Concat(_map.Markers.Select(m => m.Code)).ToHashSet();
|
||||
|
||||
Iso3166Alpha2.Where(code => !drawn.Contains(code)).ShouldBeEmpty();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("HK")]
|
||||
[InlineData("SG")]
|
||||
[InlineData("MO")]
|
||||
[InlineData("BH")]
|
||||
[InlineData("MT")]
|
||||
public void Small_bot_heavy_countries_have_markers(string code) =>
|
||||
_map.Markers.ShouldContain(m => m.Code == code);
|
||||
|
||||
[Fact]
|
||||
public void No_country_has_both_a_polygon_and_a_marker()
|
||||
{
|
||||
var polygons = _map.Countries.Select(c => c.Code).OfType<string>().ToHashSet();
|
||||
|
||||
_map.Markers.Where(m => polygons.Contains(m.Code)).ShouldBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Markers_lie_inside_the_map() =>
|
||||
_map.Markers.ShouldAllBe(m => m.X >= 0 && m.X <= _map.Width && m.Y >= 0 && m.Y <= _map.Height);
|
||||
}
|
||||
Reference in new issue
Block a user