private void AddToWptListCase2And4(WaypointList wptList) { var entry = new StarEntry( "18", "STAR1", List(wpt101, wpt102, wpt103, wpt104), EntryType.RwySpecific); var adder = new StarAdder( "AXYZ", new StarCollection(List(entry)), wptList, wptList.GetEditor(), GetAirportManager()); int rwyIndex = adder.AddStarsToWptList("18", List("STAR1")); // Check the STAR1 has been added with correct total distance. var edges = wptList.EdgesTo(rwyIndex).ToList(); Assert.IsTrue(edges.Count > 0); Assert.IsTrue(edges .Select(e => wptList.GetEdge(e)) .All(e => e.Value.InnerWaypoints.SequenceEqual(List(wpt102, wpt103, wpt104)) && e.Value.Type == InnerWaypointsType.Terminal)); double dis = List(wpt101, wpt102, wpt103, wpt104, rwy) .TotalDistance(); Assert.IsTrue(StarIsAdded( wptList.FindByWaypoint(wpt101), "STAR1", dis, wptList)); // Check the edges of first wpt int index = wptList.FindByWaypoint(wpt101); Assert.IsTrue(index >= 0); Assert.AreEqual(2, wptList.EdgesToCount(index)); foreach (var i in wptList.EdgesTo(index)) { var edge = wptList.GetEdge(i); Assert.AreEqual("DCT", edge.Value.Airway); Assert.AreEqual(0, edge.Value.InnerWaypoints.Count); double expectedDis = wpt101.Distance(wptList[edge.FromNodeIndex]); Assert.AreEqual(expectedDis, edge.Value.Distance, DistanceEpsilon); } }
public void AddToWptListCase1() { var wptList = BasicWptList(); var adder = new StarAdder( "AXYZ", new StarCollection(new List <StarEntry>()), wptList, wptList.GetEditor(), GetAirportManager()); int rwyIndex = adder.AddStarsToWptList("18", new List <string>()); // Check the STAR is added Assert.IsTrue(DirectAdded(wptList, new Waypoint("25N050E", 25.0, 50.0), rwyIndex)); Assert.IsTrue(DirectAdded(wptList, new Waypoint("27N050E", 27.0, 50.0), rwyIndex)); }
public void AddToWptListCase3() { var wptList = BasicWptList(); var wptCorrds = new Waypoint("26N050E", 26.0, 50.0); var wpt01 = new Waypoint("WPT01", 25.0, 50.0); var entry = new StarEntry( "18", "STAR1", List(wptCorrds, wpt01), EntryType.RwySpecific); var adder = new StarAdder( "AXYZ", new StarCollection(List(entry)), wptList, wptList.GetEditor(), GetAirportManager()); int rwyIndex = adder.AddStarsToWptList("18", List("STAR1")); // Check the STAR1 has been added with correct total distance. var edges = wptList.EdgesTo(rwyIndex).ToList(); Assert.AreEqual(1, edges.Count); var edge = wptList.GetEdge(edges[0]); Assert.IsTrue(edge.Value.InnerWaypoints.SequenceEqual(List(wpt01))); Assert.AreEqual(InnerWaypointsType.Terminal, edge.Value.Type); double dis = List(wptCorrds, wpt01, rwy).TotalDistance(); Assert.IsTrue(StarIsAdded( wptList.FindByWaypoint(wptCorrds), "STAR1", dis, wptList)); }