public void MOCKFileHandlerAddPlayer()
        {
            var testHandler = new MOCKFileHandler();
            testHandler.LoadPlayers();
            var testHandlerPlayers = testHandler.GetPlayers();
            var testPlayers = TestPlayers();

            var newPlayer = new Player("Bob", "Dude", 12, "Mummy", "5552189", "Can't run");
            testHandler.InsertPlayer(newPlayer);
            testPlayers.Add(testPlayers.Count+1, newPlayer);
            foreach (var item in testPlayers)
            {
                Assert.AreEqual(item.Value.Details(), testHandlerPlayers[item.Key].Details());
            }
        }
        public void MOCKFileHandlerEditPlayer()
        {
            var testHandler = new MOCKFileHandler();
            testHandler.LoadPlayers();
            var testHandlerPlayers = testHandler.GetPlayers();
            var testPlayers = TestPlayers();
            var editPlayer = new Player("bob", "smith", 10, "someone", "4545454", "Sickly");
            var playerEdited = 0;
            editPlayer.SetP_ID(playerEdited);
            testPlayers[playerEdited] = editPlayer;
            testHandler.UpdatePlayer(editPlayer);

            foreach (var item in testPlayers)
            {
                Assert.AreEqual(item.Value.Details(), testHandlerPlayers[item.Key].Details());
            }
        }
        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());
            }
        }
 public void MOCKFileHandlerDeleteTeamPlayer()
 {
     var teamID = 1;
     var playerID = 1;
     var testHandler = new MOCKFileHandler();
     testHandler.LoadPlayers();
     testHandler.LoadTeams();
     var testHandlerPlayers = testHandler.GetPlayers();
     var testPlayers = TestPlayers();
     var team = testHandler.GetTeam(teamID);
     team.SetTeamID(teamID);
     var player = testHandler.GetPlayer(1);
     var testPlayer = new Player("john", "smith", 24, "", "40404040", "");
     testPlayer.SetP_ID(playerID);
     Assert.AreEqual(player.Details(), testPlayer.Details());
     testHandler.DeleteTeamPlayer(team.GetTeamID(), playerID);
     Assert.AreEqual(0, testHandler.GetTeam(1).GetPlayerIDs().Count);
     team.RemovePlayer(player.GetP_ID());
     Assert.AreEqual(team.GetPlayerIDs(), testHandler.GetTeam(teamID).GetPlayerIDs());
 }
 public void MOCKFileHandlerLoadPlayers()
 {
     var testHandler = new MOCKFileHandler();
     testHandler.LoadPlayers();
     var testHandlerPlayers = testHandler.GetPlayers();
     foreach(var item in TestPlayers())
     {
         Assert.AreEqual(item.Value.Details(), testHandlerPlayers[item.Key].Details());
     }
 }