Ejemplo n.º 1
0
        public void Initializace()
        {
            playerName  = RandomString(4);
            playerName2 = RandomString(5);

            PlayerDAO dao    = new PlayerDAO();
            Player    player = CreatePlayer();

            dao.InsertPlayer(player);
            playerFrom        = player;
            player            = CreatePlayer();
            player.PlayerName = playerName2;
            dao.InsertPlayer(player);
            playerTo = player;
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void Initializace()
        {
            //Database.SetInitializer(new CreateDatabaseIfNotExists<SpaceTrafficContext>());
            PlayerDAO dao = new PlayerDAO();

            player = CreatePlayer();
            dao.InsertPlayer(player);
        }
Ejemplo n.º 4
0
        public void RemovePlayerByIdTest()
        {
            PlayerDAO dao    = new PlayerDAO();
            Player    player = CreatePlayer();

            player.PlayerName = "player2";
            dao.InsertPlayer(player);
            int id = dao.GetPlayerByName("player2").PlayerId;

            dao.RemovePlayerById(id);
            Assert.IsNull(dao.GetPlayerById(id));
        }
Ejemplo n.º 5
0
 //Método para registrar el usuario y puntaje en la base de datos
 public static void RegisterPlayer()
 {
     foreach (Player user in PlayerDAO.GetPlayers())
     {
         if (user.nickname.Equals(player))
         {
             ScoreDAO.AddScore(scoreBlocks + BonusPoints(), player);
             return;
         }
     }
     PlayerDAO.InsertPlayer(player);
     ScoreDAO.AddScore(scoreBlocks + BonusPoints(), player);
 }
Ejemplo n.º 6
0
        public void InsertPlayerTest()
        {
            PlayerDAO dao    = new PlayerDAO();
            Player    player = CreatePlayer();

            player.PlayerName = "player2";
            bool result = dao.InsertPlayer(player);

            Assert.IsTrue(result);
            Player insertPlayer = dao.GetPlayerByName("player2");

            dao.RemovePlayerById(insertPlayer.PlayerId);
        }
Ejemplo n.º 7
0
        public void Initializace()
        {
            PlayerDAO dao = new PlayerDAO();

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

            BaseDAO bas = new BaseDAO();

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