public void MOCKFileHandlerDeletePlayer()
        {
            var testHandler = new MOCKFileHandler();
            testHandler.LoadPlayers();
            var testHandlerPlayers = testHandler.GetPlayers();
            var testPlayers = TestPlayers();
            var DeletePlayer = new Player("john", "smith", 24, "", "40404040", "");
            var playerDeleted = 0;
            DeletePlayer.SetP_ID(playerDeleted);
            testPlayers.Remove(playerDeleted);
            testHandler.DeletePlayer(DeletePlayer.GetP_ID());

            foreach (var item in testPlayers)
            {
                Assert.AreEqual(item.Value.Details(), testHandlerPlayers[item.Key].Details());
            }
        }
Exemplo n.º 2
0
 public void UpdatePlayer(Player editPlayer)
 {
     players[editPlayer.GetP_ID()] = editPlayer;
 }
Exemplo n.º 3
0
 public void UpdatePlayer(Player editPlayer)
 {
     players[editPlayer.GetP_ID()] = editPlayer;
     var updatePlayer = SqlQueries.UpdatePlayer(editPlayer.GetP_ID(), editPlayer.GetFName(), editPlayer.GetLName(), editPlayer.GetAge(), editPlayer.GetGuardian(), editPlayer.GetContact(), editPlayer.GetMedical());
     var updatePlayerCommand = new SQLiteCommand(updatePlayer, dbConnection);
     updatePlayerCommand.ExecuteNonQuery();
 }
Exemplo n.º 4
0
 public void InsertPlayer(Player newPlayer)
 {
     newPlayer.SetP_ID(playerCounter);
     players.Add(playerCounter++, newPlayer);
     var insertPlayer = SqlQueries.InsertPlayer(newPlayer.GetP_ID(), newPlayer.GetFName(), newPlayer.GetLName(), newPlayer.GetAge(), newPlayer.GetGuardian(), newPlayer.GetContact(), newPlayer.GetMedical());
     var insertPlayerCommand = new SQLiteCommand(insertPlayer, dbConnection);
     insertPlayerCommand.ExecuteNonQuery();
 }