コード例 #1
0
        public void Initialize()
        {
            CargoDAO cargoDao = new CargoDAO();

            cargo1      = CreateCargo();
            cargo2      = CreateCargo();
            cargo2.Type = "newtype";
            cargoDao.InsertCargo(cargo1);
            cargoDao.InsertCargo(cargo2);

            BaseDAO bas = new BaseDAO();

            newBase        = new Base();
            newBase.Planet = "Země";
            bas.InsertBase(newBase);

            PlayerDAO playerDao = new PlayerDAO();

            player = CreatePlayer();
            playerDao.InsertPlayer(player);

            SpaceShipDAO shipDao = new SpaceShipDAO();

            ship = CreateSpaceShip();
            shipDao.InsertSpaceShip(ship);
        }
コード例 #2
0
        public void GetSpaceShipByIdTest()
        {
            SpaceShipDAO target    = new SpaceShipDAO();
            SpaceShip    spaceShip = CreateSpaceShip();

            target.InsertSpaceShip(spaceShip);
            SpaceShip actual = target.GetSpaceShipById(spaceShip.SpaceShipId);

            Assert.IsNotNull(actual);
        }
コード例 #3
0
        public void GetSpaceShipsByPlayerTest()
        {
            SpaceShipDAO target    = new SpaceShipDAO();
            SpaceShip    spaceShip = CreateSpaceShip();

            target.InsertSpaceShip(spaceShip);
            List <SpaceShip> spaceShips = target.GetSpaceShipsByPlayer(player.PlayerId);

            Assert.IsNotNull(spaceShips);

            target.RemoveSpaceShipById(spaceShip.SpaceShipId);
        }
コード例 #4
0
        public void GetSpaceShipsTest()
        {
            SpaceShipDAO target    = new SpaceShipDAO();
            SpaceShip    spaceShip = CreateSpaceShip();

            target.InsertSpaceShip(spaceShip);
            List <SpaceShip> spaceShips = target.GetSpaceShips();

            Assert.IsTrue(spaceShips.Count > 0);

            target.RemoveSpaceShipById(spaceShip.SpaceShipId);
        }
コード例 #5
0
        public void InsertSpaceShipTest()
        {
            SpaceShipDAO target    = new SpaceShipDAO();
            SpaceShip    spaceShip = CreateSpaceShip();
            bool         result    = target.InsertSpaceShip(spaceShip);

            Assert.IsTrue(result);

            SpaceShip actual = target.GetSpaceShipById(spaceShip.SpaceShipId);

            Assert.IsNotNull(actual);

            target.RemoveSpaceShipById(spaceShip.SpaceShipId);
        }
コード例 #6
0
        public void UpdateSpaceShipByIdTest()
        {
            SpaceShipDAO target    = new SpaceShipDAO();
            SpaceShip    spaceShip = CreateSpaceShip();
            bool         result    = target.InsertSpaceShip(spaceShip);

            Assert.IsTrue(result);

            SpaceShip actual = target.GetSpaceShipById(spaceShip.SpaceShipId);


            spaceShip.IsFlying          = false;
            spaceShip.DamagePercent     = 70;
            spaceShip.CurrentStarSystem = "Mars";
            target.UpdateSpaceShipById(spaceShip);

            SpaceShip compare = target.GetSpaceShipById(spaceShip.SpaceShipId);

            Assert.IsTrue(compare.IsFlying.Equals(false) & compare.DamagePercent == 70
                          & compare.CurrentStarSystem.Equals("Mars"));

            target.RemoveSpaceShipById(spaceShip.SpaceShipId);
        }