public void GetAllPlayersFileOKTest() { string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json"); PlayersManagement playerMgt = new PlayersManagement(); List <Player> playerslist = playerMgt.GetAllPlayers(filePath); Assert.AreEqual(5, playerslist.Count); }
public void GetNotExistantPlayerByIdTest() { int id = 1; string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json"); PlayersManagement playerMgt = new PlayersManagement(); List <Player> playersList = playerMgt.GetAllPlayers(filePath); Player existantPlayer = playerMgt.GetPlayerById(playersList, id); Assert.AreEqual(null, existantPlayer); }
public void DeleteExistantPlayerByIdTest() { int id = 17; string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/headtohead.json"); PlayersManagement playerMgt = new PlayersManagement(); List <Player> playersList = playerMgt.GetAllPlayers(filePath); Player deletedPlayer = playerMgt.DeletePlayerById(playersList, id); Assert.AreEqual(17, deletedPlayer.id); Assert.AreEqual(4, playersList.Count); }