示例#1
0
        public void WhenRouteUseDirectAnalyzeCorrectness()
        {
            // setup
            var wpts = new[]
            {
                new Waypoint("P01", 0.0, 15.0),
                new Waypoint("P02", 0.0, 16.0),
                new Waypoint("P03", 0.5, 16.5)
            };

            var wptList = new WaypointList();

            foreach (var i in wpts)
            {
                wptList.AddWaypoint(i);
            }

            var analyzer = new BasicRouteAnalyzer(
                GetRouteString("P01", "P02", "P03"),
                wptList,
                wptList.FindById("P01"));

            // invoke
            var route = analyzer.Analyze();

            // assert
            var expected = GetRoute(
                wpts[0], "DCT", -1.0,
                wpts[1], "DCT", -1.0,
                wpts[2]);

            Assert.IsTrue(route.Equals(expected));
        }
示例#2
0
        public void WhenIdentDoesNotExistShouldThrowException()
        {
            // setup
            var wptList = new WaypointList();

            wptList.AddWaypoint(new Waypoint("P01", 3.051, 20.0));

            var analyzer = new BasicRouteAnalyzer(
                GetRouteString("P01", "P02"),
                wptList,
                0);

            // invoke
            Assert.Throws <ArgumentException>(() => analyzer.Analyze());
        }
示例#3
0
        public void WhenRouteUseCoordAnalyzeCorrectness()
        {
            // setup
            var analyzer = new BasicRouteAnalyzer(
                GetRouteString("N41W050", "N41.30W50.55"),
                new WaypointList(),
                -1);

            // invoke
            var route = analyzer.Analyze();

            // assert
            var expected = GetRoute(
                new Waypoint("N41W050", 41.0, -50.0), "DCT", -1.0,
                new Waypoint("N41.30W50.55", 41.30, -50.55));

            Assert.IsTrue(route.Equals(expected));
        }
示例#4
0
        public void SingleEntryInRoute()
        {
            // setup
            var wptList = new WaypointList();
            var p       = new Waypoint("P", 20.0, 100.0);

            wptList.AddWaypoint(p);

            var analyzer = new BasicRouteAnalyzer(
                GetRouteString("P"),
                wptList,
                wptList.FindById("P"));

            // invoke
            var route = analyzer.Analyze();

            // assert
            Assert.AreEqual(1, route.Count);
            Assert.IsTrue(route.FirstWaypoint.Equals(p));
        }
示例#5
0
        public void WhenRouteUseAirwaysAnalyzeCorrectness()
        {
            // setup
            var wpts = new[]
            {
                new Waypoint("P01", 0.0, 15.0),
                new Waypoint("P02", 0.0, 16.0),
                new Waypoint("P03", 0.0, 17.0),
                new Waypoint("P04", 0.0, 18.0)
            };

            var wptList = new WaypointList();
            var indices = wpts.Select(w => wptList.AddWaypoint(w)).ToList();

            wptList.AddNeighbor(indices[0], "A01", indices[1]);
            wptList.AddNeighbor(indices[1], "A02", indices[2]);

            // Added so that there are 2 airways to choose from at P03.
            wptList.AddNeighbor(indices[1], "A03", indices[3]);

            var analyzer = new BasicRouteAnalyzer(
                GetRouteString("P01", "A01", "P02", "A02", "P03"),
                wptList,
                wptList.FindById("P01"));

            // invoke
            var route = analyzer.Analyze();

            // assert
            var expected = GetRoute(
                wpts[0], "A01", -1.0,
                wpts[1], "A02", -1.0,
                wpts[2]);

            Assert.IsTrue(route.Equals(expected));
        }