public void EqualsWhenCompetitionsAreEqualShouldReturnTrue() { string[,] teamList = { { "Team 1", "12" }, { "Team 2", "10" } }; Competition initialCompetition = new Competition(teamList); Competition competitionToCompare = new Competition(teamList); Assert.True(initialCompetition.Equals(competitionToCompare)); }
public void EqualsWhenCompetitionsAreNotEqualShouldReturnFalse() { string[,] initialteamList = { { "Team 1", "12" }, { "Team 2", "10" } }; Competition initialCompetition = new Competition(initialteamList); string[,] teamListToCompare = { { "Team 1", "12" }, { "Team 2", "11" } }; Competition competitionToCompare = new Competition(teamListToCompare); Assert.False(initialCompetition.Equals(competitionToCompare)); }
private void CreerCompetClick(object sender, RoutedEventArgs e) { Sauvegarde(); BoutonD.Visibility = Visibility.Visible; BoutonR.Visibility = Visibility.Visible; BoutonN.Visibility = Visibility.Visible; reussite.Text = ""; string nomCompet = nomCompetbox.Text; int capacite = Convert.ToInt32(capacitebox.Text); int ageMin = Convert.ToInt32(ageMinbox.Text); string nomEquipe1 = nomEquipeBox1.Text; List <Equipe> listE = new List <Equipe>(); if (ListStatic.lEquipe != null) { for (int i = 0; i < ListStatic.lEquipe.Count; i++) { if (ListStatic.lEquipe[i].NomEquipe == nomEquipe1) { listE.Add(ListStatic.lEquipe[i]); //Equipe } } if (listE.Count == 0 || listE == null) { reussite.Text = "L'Équipe voulue n'existe pas, allez dans Créer Équipe"; } else { int index = -1; Competition newCompet = new Competition(nomCompet, this.niveau, capacite, ageMin, nomEquipe1, false); for (int i = 0; i < ListStatic.lCompet.Count; i++) { if (newCompet.Equals(ListStatic.lCompet[i])) { index = i; } } if (newCompet.CritereAge(listE)) { if (index == -1) { reussite.Text = "Compétition créée et équipe insérée"; } else { reussite.Text = "Équipe insérée avec succès"; } ListStatic.lCompet.Add(newCompet); } else { reussite.Text = "Un membre est trop jeune pour particper"; } } } else { reussite.Text = "Aucune équipe créée encore"; } nomCompetbox.Text = "Nom de la compétition"; capacitebox.Text = "Capacité de la compétition (chiffre)"; ageMinbox.Text = "Age minimum"; nomEquipeBox.Text = "Nom de l'équipe"; Sauvegarde(); }