Beispiel #1
0
        public ModulManager(Main main)
        {
            this.main = main;
            update = new UpdateSystem(main);
            tech = new TechSystem(main);
            res = new Resources(main);
            build = new BuildSystem(main);
            fleet = new FlottenManagement(main);
            relation = new RelationManager(main);
            nodetracking = new NodeTrackingSystem(main);
            map = new MapHandler(main);

            //Test.NodeTrackingTest test = new Test.NodeTrackingTest();

            HandleModuls();
        }
        public void getRouteTest()
        {
            Solarsystem A = new Solarsystem();
            A.name = "A";
            Solarsystem B = new Solarsystem();
            B.name = "B";
            Solarsystem C = new Solarsystem();
            C.name = "C";

            Solarsystem D = new Solarsystem();
            D.name = "D";

            List<Solarsystem> systems = new List<Solarsystem>();
            systems.Add(A);
            systems.Add(B);
            systems.Add(C);
            systems.Add(D);

            Node AB = new Node();
            AB.distance = 1;
            AB.pointa = A;
            AB.pointb = B;
            A.nodes.Add(AB);
            B.nodes.Add(AB);

            Node AC = new Node();
            AC.distance = 10;
            AC.pointa = A;
            AC.pointb = C;
            A.nodes.Add(AC);
            C.nodes.Add(AC);

            Node BD = new Node();
            BD.distance = 100;
            BD.pointa = B;
            BD.pointb = D;
            B.nodes.Add(BD);
            D.nodes.Add(BD);

            Node CD = new Node();
            CD.distance = 5;
            CD.pointa = C;
            CD.pointb = D;
            C.nodes.Add(CD);
            D.nodes.Add(CD);

            Main main = null;
            NodeTrackingSystem target = new NodeTrackingSystem(main);

            Solarsystem start = A;
            Solarsystem end = D;
            bool dontUsePing = false;
            Route actual;
            actual = target.getRoute(start, end, dontUsePing);

            Assert.AreEqual(A, actual.start);
            Assert.AreEqual(D, actual.end);
            Assert.AreEqual(15, actual.distance);
        }