| 1 | using CascadeIDE.Features.UiChrome; |
| 2 | using Xunit; |
| 3 | |
| 4 | namespace CascadeIDE.Tests; |
| 5 | |
| 6 | public sealed class AttentionZoneTests |
| 7 | { |
| 8 | [Theory] |
| 9 | [InlineData("forward", AttentionZone.Forward)] |
| 10 | [InlineData("pfd", AttentionZone.Pfd)] |
| 11 | [InlineData("mfd", AttentionZone.Mfd)] |
| 12 | [InlineData("eicas", AttentionZone.Eicas)] |
| 13 | [InlineData("hud", AttentionZone.Hud)] |
| 14 | public void TryParseCanonicalId_accepts_adr_tokens(string raw, AttentionZone expected) |
| 15 | { |
| 16 | Assert.True(AttentionZoneExtensions.TryParseCanonicalId(raw, out var z)); |
| 17 | Assert.Equal(expected, z); |
| 18 | Assert.Equal(raw, z.ToCanonicalId()); |
| 19 | } |
| 20 | |
| 21 | [Fact] |
| 22 | public void TryParseCanonicalId_rejects_null_empty_and_garbage() |
| 23 | { |
| 24 | Assert.False(AttentionZoneExtensions.TryParseCanonicalId(null, out _)); |
| 25 | Assert.False(AttentionZoneExtensions.TryParseCanonicalId("", out _)); |
| 26 | Assert.False(AttentionZoneExtensions.TryParseCanonicalId("Forward", out _)); |
| 27 | Assert.False(AttentionZoneExtensions.TryParseCanonicalId("PFD", out _)); |
| 28 | Assert.False(AttentionZoneExtensions.TryParseCanonicalId(" primary ", out _)); |
| 29 | } |
| 30 | |
| 31 | [Fact] |
| 32 | public void All_lists_five_ids_in_lockstep_with_enum() |
| 33 | { |
| 34 | Assert.Equal(5, AttentionZoneIds.All.Length); |
| 35 | foreach (var id in AttentionZoneIds.All) |
| 36 | { |
| 37 | Assert.True(AttentionZoneExtensions.TryParseCanonicalId(id, out var z)); |
| 38 | Assert.Equal(id, z.ToCanonicalId()); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | [Fact] |
| 43 | public void Spatial_anchor_flags_match_adr() |
| 44 | { |
| 45 | Assert.True(AttentionZone.Forward.IsSpatialAnchor()); |
| 46 | Assert.True(AttentionZone.Pfd.IsSpatialAnchor()); |
| 47 | Assert.True(AttentionZone.Mfd.IsSpatialAnchor()); |
| 48 | Assert.False(AttentionZone.Eicas.IsSpatialAnchor()); |
| 49 | Assert.False(AttentionZone.Hud.IsSpatialAnchor()); |
| 50 | } |
| 51 | |
| 52 | [Fact] |
| 53 | public void Eicas_and_Hud_classifiers() |
| 54 | { |
| 55 | Assert.True(AttentionZone.Eicas.IsAlertingChannel()); |
| 56 | Assert.False(AttentionZone.Pfd.IsAlertingChannel()); |
| 57 | |
| 58 | Assert.True(AttentionZone.Hud.IsHudLayer()); |
| 59 | Assert.False(AttentionZone.Forward.IsHudLayer()); |
| 60 | } |
| 61 | } |
| 62 | |