Ejemplo n.º 1
0
        public void ClenUp()
        {
            PlayerDAO dao = new PlayerDAO();
            int       id  = dao.GetPlayerByName("player").PlayerId;

            dao.RemovePlayerById(id);
        }
Ejemplo n.º 2
0
        public void GetPlayerByNameTest()
        {
            PlayerDAO dao    = new PlayerDAO();
            Player    player = dao.GetPlayerByName("player");

            Assert.IsNotNull(player);
            Assert.IsTrue(player.PlayerName == "player");
        }
Ejemplo n.º 3
0
        public void GetPlayerByIdTest()
        {
            PlayerDAO dao    = new PlayerDAO();
            int       id     = dao.GetPlayerByName("player").PlayerId;
            Player    player = dao.GetPlayerById(id);

            Assert.IsTrue(player.PlayerId == id);
            Assert.IsNotNull(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
        public void UpdatePlayerByIdTest()
        {
            PlayerDAO dao    = new PlayerDAO();
            int       id     = dao.GetPlayerByName("player").PlayerId;
            Player    player = dao.GetPlayerById(id);

            player.FirstName = "Lukáš";
            bool   result        = dao.UpdatePlayerById(player);
            Player comparePlayer = dao.GetPlayerById(id);

            Assert.IsTrue(result);
            Assert.IsTrue(comparePlayer.FirstName.Equals("Lukáš"));
        }
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);
        }