示例#1
0
        public void ShipUnloading1()
        {
            Universe        u    = new Universe(0);
            Station         s    = u.GetStation(1);
            Station         s2   = u.GetStation(2);
            Corporation     corp = u.CreateCorp(1);
            Ship            ship = s.CreateShip(corp);
            Hangar          h    = s.CreateHangar(corp);
            ResourceElement e    = new ResourceElement(ResourceElement.ResourceType.Wastes, s, 100, 1);

            ship.Cargo.Add(new ResourceStack(e));

            ShipDestination dest = ship.AddDestination(s);

            dest.AddUnload(ResourceElement.ResourceType.Wastes, 100);

            ShipDestination dest2 = ship.AddDestination(s2);

            ship.Start();

            for (int ite = 0; ite < 10; ite++)
            {
                u.Update();
            }

            Assert.AreEqual(0, ship.Cargo.GetResourceQte(ResourceElement.ResourceType.Wastes));
            Assert.AreEqual(100, h.GetResourceQte(ResourceElement.ResourceType.Wastes));
        }
示例#2
0
        public void HangarConstruction()
        {
            Hangar h = new Hangar(station, corporation);

            Assert.AreEqual(station, h.Station);
            Assert.AreEqual(corporation, h.Corporation);
            Assert.AreEqual(0, h.GetResourceQte(ResourceElement.ResourceType.Wastes));
        }
示例#3
0
        public void HangarTransactions1()
        {
            Hangar h = new Hangar(station, corporation);

            ResourceElement elem1  = new ResourceElement(ResourceElement.ResourceType.Wastes, station, 100, 1);
            ResourceStack   stack1 = new ResourceStack(elem1);

            h.Add(stack1);
            Assert.AreEqual(100, h.GetResourceQte(ResourceElement.ResourceType.Wastes));
            Assert.AreEqual(0, stack1.Qte);

            ResourceElement elem2  = new ResourceElement(ResourceElement.ResourceType.ToxicWaste, station, 50, 2);
            ResourceStack   stack2 = new ResourceStack(elem2);

            h.Add(stack2);
            Assert.AreEqual(100, h.GetResourceQte(ResourceElement.ResourceType.Wastes));
            Assert.AreEqual(0, stack1.Qte);
            Assert.AreEqual(50, h.GetResourceQte(ResourceElement.ResourceType.ToxicWaste));
            Assert.AreEqual(0, stack2.Qte);
        }
示例#4
0
        public void HangarRemoveResources()
        {
            Hangar h = new Hangar(station, corporation);

            ResourceElement elem1  = new ResourceElement(ResourceElement.ResourceType.Wastes, station, 100, 1);
            ResourceStack   stack1 = new ResourceStack(elem1);

            h.Add(stack1);

            ResourceElement elem2  = new ResourceElement(ResourceElement.ResourceType.Wastes, station, 100, 2);
            ResourceElement elem3  = new ResourceElement(ResourceElement.ResourceType.Wastes, station, 100, 3);
            ResourceStack   stack2 = new ResourceStack(elem2);

            stack2.Add(elem3);
            h.Add(stack2);

            ResourceStack outStack = h.GetStack(ResourceElement.ResourceType.Wastes, 50);

            Assert.NotNull(outStack);
            Assert.AreEqual(50, outStack.Qte);
            Assert.AreEqual(ResourceElement.ResourceType.Wastes, outStack.Type);
            Assert.AreEqual(250, h.GetResourceQte(ResourceElement.ResourceType.Wastes));
        }