namespace Nonemm.Spotting.Tests; public class ClusterListTests { /// Four rows in the shape the NG3K page uses, one of each thing that has to /// be read: a port after a colon, a port after a space, no port at all, and /// the same node listed twice. private const string Page = """
K1TTT k1ttt.net:7373
(dynamically assigned)
call YCCC AR-Cluster (Peru, MA)
W4MYA dxc.w4mya.us 7373 callW4MYA CC-Cluster (Bumpass, VA)
W3LPL dxc.w3lpl.net callW3LPL AR-Cluster, v.4
K1TTT again k1ttt.net:7373
"""; [Fact] public void EveryNodeOnThePageIsRead() { IReadOnlyList nodes = ClusterList.Parse(Page); Assert.Equal(["k1ttt.net:7373", "dxc.w4mya.us:7373", "dxc.w3lpl.net:23"], nodes.Select(n => n.Address)); } [Fact] public void TheNameAndTheNoteComeFromTheRow() { ClusterNode node = ClusterList.Parse(Page)[0]; Assert.Equal("K1TTT", node.Name); Assert.Equal("YCCC AR-Cluster (Peru, MA)", node.Description); } [Fact] public void APageWithNoNodesIsRefused() { Assert.Throws(() => ClusterList.Parse("down for maintenance")); } }