예제 #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());
 }
예제 #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);
 }
예제 #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()));
            }
        }
예제 #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();
 }
예제 #5
0
 public void TeamTestIsValidTeam()
 {
     var team = new Team("Wildcats", "454545467", new List<int>());
     Assert.IsTrue(team.IsValidTeam());
 }
예제 #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();
 }
예제 #8
0
 public void UpdateTeam(Team team)
 {
     teams[team.GetTeamID()] = team;
 }
예제 #9
0
 public void InsertTeam(Team team)
 {
     teams.Add(teamCounter++, team.Clone());
 }
예제 #10
0
 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();
     }
 }
예제 #11
0
 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();
     }
 }
예제 #12
0
 public void SetTeam(Team team)
 {
     this.team = team;
 }
예제 #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();
     }
 }
예제 #14
0
 public void ShowTeam(Team team, Dictionary<int, Player> players)
 {
     SetTeamName(team.GetTeamName());
     SetTeamContact(team.GetTeamContact());
     lvPlayers.Items.Clear();
     lvPlayers.ItemsSource = players;
 }