Beispiel #1
0
 public void TeamCloneTest()
 {
     var players = new List<int>();
     foreach (var player in GetPlayers())
     {
         players.Add(player.Key);
     }
     var team = new Team("WildCats", "4545454", players);
     Assert.AreNotSame(team, team.Clone());
 }
Beispiel #2
0
 public void SetTeamDetail(int teamID)
 {
     this.teamID = teamID;
     team = fileHandler.GetTeam(teamID);
     teamView.SetTeam(team);
     var playerIDs = team.GetPlayerIDs();
     players = new Dictionary<int, Player>();
     foreach(var ID in playerIDs)
     {
         players.Add(ID, fileHandler.GetPlayer(ID));
     }
     teamView.ShowPlayers(players);
 }
Beispiel #3
0
        public void TeamTestAddPlayers()
        {
            var team = new Team("Wildcats", "47404049", new List<int>());
            var players = GetPlayers();
            foreach(var player in players)
            {
                team.AddPlayer(player.Value.GetP_ID());
            }
            var teamPlayers = team.GetPlayerIDs();

            foreach (var player in players)
            {
                Assert.IsTrue(teamPlayers.Contains(player.Value.GetP_ID()));
            }
        }
Beispiel #4
0
 private void HandleBtnView_Click(object sender, RoutedEventArgs e)
 {
     var teamEdit = new TeamEdit(fileHandler);
     teamEdit.SetTeam(team);
     teamEdit.SetPlayers(players);
     teamEdit.ShowTeam();
     teamView.Hide();
     ModalDisplay.ShowModal(teamEdit, teamView);
     if (teamEdit.GetButtonAction().Equals(ButtonAction.DONE))
     {
         team = teamEdit.GetTeam();
         team.SetTeamID(teamID);
         fileHandler.UpdateTeam(team);
         SetTeamDetail(teamID);
     }
     teamView.ShowDialog();
 }
Beispiel #5
0
 public void TeamTestIsValidTeam()
 {
     var team = new Team("Wildcats", "454545467", new List<int>());
     Assert.IsTrue(team.IsValidTeam());
 }
Beispiel #6
0
 public void TeamTestIsNotValidTeam()
 {
     var team = new Team("","", new List<int>());
     Assert.IsFalse(team.IsValidTeam());
 }
 public void SetTeam(Team team)
 {
     lblTeamContact.Content = team.GetTeamContact();
     lblTeamName.Content = team.GetTeamName();
 }
 public void UpdateTeam(Team team)
 {
     teams[team.GetTeamID()] = team;
 }
 public void InsertTeam(Team team)
 {
     teams.Add(teamCounter++, team.Clone());
 }
 public void UpdateTeam(Team team)
 {
     var teamID = team.GetTeamID();
     teams[teamID] = team;
     var queries = new List<string>();
     queries.Add(SqlQueries.DeleteTeamPlayers(teamID));
     foreach (var playerID in team.GetPlayerIDs())
     {
         queries.Add(SqlQueries.InsertPlayerTeam(teamID, playerID));
     }
     queries.Add(SqlQueries.UpdateTeam(teamID, team.GetTeamName(), team.GetTeamContact()));
     foreach (var query in queries)
     {
         var command = new SQLiteCommand(query, dbConnection);
         command.ExecuteNonQuery();
     }
 }
 public void InsertTeam(Team team)
 {
     var teamID = teamCounter++;
     team.SetTeamID(teamID);
     teams.Add(teamID, team.Clone());
     var queries = new List<string>();
     queries.Add(SqlQueries.InsertTeam(teamID, team.GetTeamName(), team.GetTeamContact()));
     foreach (var playerID in team.GetPlayerIDs())
     {
         queries.Add(SqlQueries.InsertPlayerTeam(teamID, playerID));
     }
     foreach (var query in queries)
     {
         var command = new SQLiteCommand(query, dbConnection);
         command.ExecuteNonQuery();
     }
 }
Beispiel #12
0
 public void SetTeam(Team team)
 {
     this.team = team;
 }
Beispiel #13
0
 private void HandleBtnDone_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     team = new Team(GetTeamName(), GetTeamContanct(), GetTeamPlayerIDs());
     if (team.IsValidTeam())
     {
         buttonAction = ButtonAction.DONE;
         modalTeam.Close();
     }
     else
     {
         modalTeam.DisplayError();
     }
 }
 public void ShowTeam(Team team, Dictionary<int, Player> players)
 {
     SetTeamName(team.GetTeamName());
     SetTeamContact(team.GetTeamContact());
     lvPlayers.Items.Clear();
     lvPlayers.ItemsSource = players;
 }