예제 #1
0
        public void Generate_ScrapFleets()
        {
            SimpleTurnGenerator turnGenerator = new SimpleTurnGenerator(serverData);

            Assert.IsNotEmpty(serverData.IterateAllFleets().ToList());
            turnGenerator.Generate();
            Console.WriteLine(fleets.First().Composition.Count());
            Assert.AreEqual(fleets.First().Composition.Count(), 0);
            Assert.IsEmpty(serverData.IterateAllFleets().ToList());
        }
예제 #2
0
        public void Generate_Dont_ScrapFleets()
        {
            // ToDo: Fleet-Generation and other things to seperate class/es and/or methods
            Fleet fleet = new Fleet(2);

            fleet.Owner = 1;
            NovaPoint point = new NovaPoint(0, 0);

            fleet.Position = point;
            ShipDesign shipDesign = new ShipDesign(2);

            shipDesign.Blueprint = new Component();
            Hull hull = new Hull();

            hull.Modules = new List <HullModule>();
            hull.Modules.Add(new HullModule());
            shipDesign.Blueprint.Properties.Add("Hull", hull);
            ShipToken shipToken = new ShipToken(shipDesign, 1);

            fleet.Composition.Add(shipToken.Key, shipToken);
            fleets.Add(fleet);
            Waypoint  waypoint      = new Waypoint();
            NovaPoint waypointpoint = new NovaPoint(1, 1);

            waypoint.Position = waypointpoint;
            IWaypointTask task = new NoTask();

            waypoint.Task        = task;
            waypoint.Destination = "Star1";
            fleet.Waypoints.Add(waypoint);

            empireData.AddOrUpdateFleet(fleet);
            // empireData.OwnedFleets.Add(fleet); // ToDo: this should not be allowed I think

            Console.WriteLine("2 Fleets: " + fleets.Count());
            Assert.IsNotEmpty(serverData.IterateAllFleets().ToList());
            Console.WriteLine("all Fleets count: " + serverData.IterateAllFleets().ToList().Count());

            SimpleTurnGenerator turnGenerator = new SimpleTurnGenerator(serverData);

            turnGenerator.Generate();
            // Assert.AreEqual(fleets.First().Composition.Count(), 1);
            Assert.IsNotEmpty(serverData.IterateAllFleets().ToList());
        }