Ejemplo n.º 1
0
        //tests the world dicitonaries
        public void CountShips()
        {
            World theWorld = new World();

            theWorld.worldSize = 750;
            theWorld.generatenewShip("1");
            theWorld.generatenewShip("2");
            Assert.IsTrue(theWorld.getShipCollection().Count == 2);
        }
Ejemplo n.º 2
0
        //tests the ships setup in the world
        public void ShipID()
        {
            World theWorld = new World();

            theWorld.worldSize = 750;
            theWorld.generatenewShip("3");
            theWorld.generatenewShip("4");
            Dictionary <int, Ship> sc = new Dictionary <int, Ship>();

            sc = theWorld.getShipCollection();
            //checking name against the id
            Assert.AreEqual(1, sc[1].getShipId());
            Assert.IsTrue(2 == sc[2].getShipId());
        }
Ejemplo n.º 3
0
        //tesing the setup of the ships
        public void setupShips()
        {
            World theWorld = new World();

            theWorld.generatenewShip("1");
            Dictionary <int, Ship> dc = new Dictionary <int, Ship>();

            dc = theWorld.shipCollection;
            dc[1].justFired(true);
            Assert.IsTrue(dc[1].getJustFired());
            int cd = dc[1].getCooldownProj();

            dc[1].resetCooldownProj();
            Assert.IsTrue(0 == cd);
            dc[1].incrementCooldownProj();
            Assert.IsTrue(1 == dc[1].getCooldownProj());
            dc[1].incrementRespawnCounter();
            Assert.IsTrue(1 == dc[1].getRespawnCounter());
            dc[1].setShipID(1);
            Assert.IsTrue(1 == dc[1].getShipId());
            dc[1].setShipThrust(true);
            Assert.IsTrue(dc[1].getShipThrust());
            dc[1].setShipLoc(new SpaceWars.Vector2D(0, 0));
            Assert.AreEqual(0, dc[1].getShipLoc().GetX());
            Assert.AreEqual(0, dc[1].getShipLoc().GetY());
            dc[1].setShipDir(new SpaceWars.Vector2D(0, 0));
            Assert.AreEqual(0, dc[1].getShipDir().GetX());
            Assert.AreEqual(0, dc[1].getShipDir().GetY());
            dc[1].setShipHp(4);
            Assert.AreEqual(4, dc[1].getShipHp());
            dc[1].setShipScore(3);
            Assert.AreEqual(3, dc[1].getShipScore());
            dc[1].setShipThrust(true);
            Assert.IsTrue(dc[1].getShipThrust());
        }
Ejemplo n.º 4
0
        //testing ID's of ship objects
        public void staticWorldID()
        {
            World theWorld = new World();

            theWorld.generatenewShip("1");
            World otherWorld = new World();

            otherWorld.generatenewShip("2");
            Assert.IsTrue(theWorld.shipCollection[1].getShipId() == 1);
        }
Ejemplo n.º 5
0
        public void ShipBasicFunctionality()
        {
            World theWorld = new World();

            theWorld.generatenewShip("1");
            Dictionary <int, Ship> dc = new Dictionary <int, Ship>();

            dc = theWorld.shipCollection;
            dc[1].setOperateRight(true);
            Assert.IsTrue(dc[1].getOperateRight());
            dc[1].setOperateLeft(true);
            Assert.IsTrue(dc[1].getOperateLeft());
        }
Ejemplo n.º 6
0
        public void shipCommandsSetup()
        {
            World theWorld = new World();

            theWorld.generatenewShip("1");
            Dictionary <int, Ship> dc = new Dictionary <int, Ship>();

            dc = theWorld.shipCollection;
            dc[1].doOperateShip('L');
            Assert.IsTrue(dc[1].getOperateLeft());
            dc[1].doOperateShip('R');
            Assert.IsTrue(dc[1].getOperateRight());
            dc[1].doOperateShip('T');
            Assert.IsTrue(dc[1].getOperateThrust());
        }