Example #1
0
 public StadeWS(Stade stade)
     : base(stade.Id)
 {
     this.Caracteristiques = stade.Caracteristiques;
     this.NbPlaces = stade.NbPlaces;
     this.planete = stade.Planete;
 }
Example #2
0
        public void TestAddMatch()
        {
            DalManager m_data = DalManager.Instance;
            Jedi jedi1 = new Jedi(18, "Jedi 1", false, null, "");
            Jedi jedi2 = new Jedi(68, "Jedi 2", true, null, "");
            Stade stade = new Stade(42, "Test 3", 42000, "Tata Ouine", null, null);
            m_data.addJedi(jedi1);
            m_data.addJedi(jedi2);
            m_data.addStade(stade);

            List<Stade> list1 = m_data.getAllStades().Where(s => s.Nom == stade.Nom && s.NbPlaces == stade.NbPlaces && s.Planete == stade.Planete).ToList();
            List<Jedi> list2 = m_data.getAllJedis().Where(j => (j.Nom == jedi1.Nom || j.Nom == jedi2.Nom)).ToList();

            Match toto = new Match(42, list2.ElementAt(0), list2.ElementAt(1), EPhaseTournoi.Finale, list1.ElementAt(0));
            m_data.addMatch(toto);
            List<Match> list = m_data.getAllMatchs().Where(m => m.Jedi1.ID == list2.ElementAt(0).ID && m.Jedi2.ID == list2.ElementAt(1).ID && m.Stade.ID == list1.ElementAt(0).ID).ToList();

            Assert.AreEqual(list2.ElementAt(0), list.ElementAt(0).Jedi1);
            Assert.AreEqual(list2.ElementAt(1), list.ElementAt(0).Jedi2);
            Assert.AreEqual(list1.ElementAt(0), list.ElementAt(0).Stade);

            m_data.delMatch(list.ElementAt(0));
            m_data.delStade(list1.ElementAt(0));
            m_data.delJedi(list2.ElementAt(0));
            m_data.delJedi(list2.ElementAt(1));
        }
Example #3
0
 public StadeWS(Stade stade )
 {
     this.Adresse = stade.Adresse;
     this.Nom = stade.Nom;
     this.Places = stade.Places;
     this.Pourcentage = stade.Pourcentage;
 }
        private void addStade_Click(object sender, RoutedEventArgs e)
        {
            int nbPlacesVal=0;

            try
            {
                nbPlacesVal = Int32.Parse(nbPlacesValue.Text);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Veuillez saisir un nombre de places correct "+exc.Message);
            }

            if (nbPlacesVal != 0 && planeteValue.Text!="" && caractAugValue.SelectedItem!=null && caractDimValue.SelectedItem !=null)
            {
                Stade stadeAdd = new Stade(nbPlacesVal, planeteValue.Text, (EDefCaracteristique)caractAugValue.SelectedItem, (EDefCaracteristique)caractDimValue.SelectedItem, 2);
                JediTournamentManager.AddStade(stadeAdd);
                GestionStade g = new GestionStade();
                g.Show();
                Close();
            }
            else
            {
                MessageBox.Show("Veuillez saisir des données correctes");
            }
        }
Example #5
0
 //Obligé de surcharger le constructeur si on veut faire
 // Match match = new Match(new Pokemon(...), new Pokemon(...)) ?
 public Match(Pokemon pokemon1, Pokemon pokemon2, Stade stade, EPhaseTournoi phase) : base(pokemon1.Nom.ToString() + " VS " + pokemon2.Nom.ToString())
 {
     PhaseTournoi = phase;
     Pokemon1     = pokemon1;
     Pokemon2     = pokemon2;
     Stade        = stade;
 }
 public Match()
 {
     IdPokemonVainqueur = -1;
     PhaseTournoi       = EPhaseTournoi.HuitiemeFinale;
     Dresseur1          = null;
     Dresseur2          = null;
     Arene = null;
 }
Example #7
0
        public StadeWS(Stade s)
        {
			this.Id = s.Id;
            this.Planete = s.Planete;
            this.NbPlaces = s.NbPlaces;
			this.Caracteristiques = new List<CaracteristiqueWS>();
            s.Caracteristiques.ForEach(x => this.Caracteristiques.Add(new CaracteristiqueWS(x)));
        }
Example #8
0
 public Match(int idJediVainqueur, Jedi jedi1, Jedi jedi2, EPhaseTournoi phaseTournoi, Stade stade, int id) : base(id)
 {
     this.idJediVainqueur = 0;
     this.jedi1           = jedi1;
     this.jedi2           = jedi2;
     this.phaseTournoi    = phaseTournoi;
     this.stade           = stade;
 }
 public Match(int idWinner, EPhaseTournoi phase, Dresseur d1, Dresseur d2, Stade stade)
 {
     IdPokemonVainqueur = idWinner;
     PhaseTournoi       = phase;
     Dresseur1          = d1;
     Dresseur2          = d2;
     Arene = stade;
 }
Example #10
0
 public Match(int idJediVainqueur,Jedi jedi1,Jedi jedi2,EPhaseTournoi phaseTournoi,Stade stade,int id):base(id)
 {
     this.idJediVainqueur = 0;
     this.jedi1 = jedi1;
     this.jedi2 = jedi2;
     this.phaseTournoi = phaseTournoi;
     this.stade = stade;
 }
Example #11
0
 public Match(int id, Jedi jedi1, Jedi jedi2, EPhaseTournoi phaseTournoi, Stade stade, Jedi vainqueur = null)
 {
     this.Id            = id;
     this.jedi1         = jedi1;
     this.jedi2         = jedi2;
     this.phaseTournoi  = phaseTournoi;
     this.stade         = stade;
     this.jediVainqueur = vainqueur;
 }
Example #12
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 /// <param name="id">Id du match.</param>
 /// <param name="jedi1">Premier jedi concurrent.</param>
 /// <param name="jedi2">Second jedi concurrent.</param>
 /// <param name="phase">Phase lors de laquelle se déroule le match.</param>
 /// <param name="stade">Stade dans lequel se déroule le match.</param>
 public Match(int id, Jedi jedi1, Jedi jedi2, EPhaseTournoi phase, Stade stade)
     : base(id)
 {
     Jedi1           = jedi1;
     Jedi2           = jedi2;
     PhaseTournoi    = phase;
     Stade           = stade;
     IdJediVainqueur = -1;   // Initialisation de l'ID à -1 => vainqueur non déterminé
 }
Example #13
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 /// <param name="id">Id du match.</param>
 /// <param name="jedi1">Premier jedi concurrent.</param>
 /// <param name="jedi2">Second jedi concurrent.</param>
 /// <param name="phase">Phase lors de laquelle se déroule le match.</param>
 /// <param name="stade">Stade dans lequel se déroule le match.</param>
 public Match(int id, Jedi jedi1, Jedi jedi2, EPhaseTournoi phase, Stade stade)
     : base(id)
 {
     Jedi1 = jedi1;
     Jedi2 = jedi2;
     PhaseTournoi = phase;
     Stade = stade;
     IdJediVainqueur = -1;   // Initialisation de l'ID à -1 => vainqueur non déterminé
 }
Example #14
0
 public Match(int pIdJediVainqueur, Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade, int pID)
 {
     ID = pID;
     IdJediVainqueur = pIdJediVainqueur;
     Jedi1 = pJedi1;
     Jedi2 = pJedi2;
     PhaseTournoi = pPhaseTournoi;
     Stade = pStade;
 }
Example #15
0
 public Match(int id, Jedi jedi1, Jedi jedi2, EPhaseTournoi phaseTournoi, Stade stade, Jedi vainqueur = null)
 {
     this.Id = id;
     this.jedi1 = jedi1;
     this.jedi2 = jedi2;
     this.phaseTournoi = phaseTournoi;
     this.stade = stade;
     this.jediVainqueur = vainqueur;
 }
Example #16
0
 public Match(int pIdJediVainqueur, Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade, int pID)
 {
     ID = pID;
     IdJediVainqueur = pIdJediVainqueur;
     Jedi1           = pJedi1;
     Jedi2           = pJedi2;
     PhaseTournoi    = pPhaseTournoi;
     Stade           = pStade;
 }
Example #17
0
 public Match(int pId, Pokemon ppokemon1, Pokemon ppokemon2, Stade pArene, int pIdTournoi, EPhaseTournoi pphase = EPhaseTournoi.QuartFinale)
 {
     ID                 = pId;
     PhaseTournoi       = pphase;
     Pokemon1           = ppokemon1;
     Pokemon2           = ppokemon2;
     Arene              = pArene;
     IdPokemonVainqueur = -1;
     IdTournoi          = pIdTournoi;
 }
        public Match(Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade)
        {
            countId++;
            Id = countId;

            JediVainqueur = null;
            Jedi1         = pJedi1;
            Jedi2         = pJedi2;
            PhaseTournoi  = pPhaseTournoi;
            Stade         = pStade;
        }
Example #19
0
 public Match(int coupeId, DateTime date, Equipe equipeDomicile, Equipe equipeVisiteur, double prix, int scoreVisiteur, int scoreDomicile, Stade stade)
 {
     this.coupeId = coupeId;
     this.date = date;
     this.equipeDomicile = equipeDomicile;
     this.equipeVisiteur = equipeVisiteur;
     this.prix = prix;
     this.scoreDomicile = scoreDomicile;
     this.scoreVisiteur = scoreVisiteur;
     this.stade = stade;
 }
 public StadeWCF(Stade stade)
     : base(stade)
 {
     this.planete = stade.Planete;
     this.nbPlaces = stade.NbPlaces;
     this.caracteristiquesWCF = new List<CaracteristiqueWCF>();
     foreach (Caracteristique c in stade.Caracteristiques)
     {
         caracteristiquesWCF.Add(new CaracteristiqueWCF(c));
     }
 }
Example #21
0
        public Match(Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade)
        {
            countId++;
            Id = countId;

            JediVainqueur = null;
            Jedi1 = pJedi1;
            Jedi2 = pJedi2;
            PhaseTournoi = pPhaseTournoi;
            Stade = pStade;
        }
        /// <summary>
        /// Adapte un Stade en Stade Contract.
        /// </summary>
        /// <param name="stade">Stade à adapter.</param>
        /// <returns>Stade contract.</returns>
        public static StadeContract fromStade(Stade stade)
        {
            if (stade == null)
                return null;

            StadeContract sc = new StadeContract(   stade.ID,
                                                    stade.Nom,
                                                    stade.NbPlaces,
                                                    stade.Planete,
                                                    CaracteristiqueAdapter.fromCaracteristiqueList(stade.Caracteristiques));
            return sc;
        }
 public Match(int _id, Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade) : base(_id)
 {
     if (_id > countId)
     {
         countId = _id;
     }
     JediVainqueur = null;
     Jedi1         = pJedi1;
     Jedi2         = pJedi2;
     PhaseTournoi  = pPhaseTournoi;
     Stade         = pStade;
 }
Example #24
0
 public Match(int _id, Jedi pJedi1, Jedi pJedi2, EPhaseTournoi pPhaseTournoi, Stade pStade) : base(_id)
 {
     if (_id > countId)
     {
         countId = _id;
     }
     JediVainqueur = null;
     Jedi1 = pJedi1;
     Jedi2 = pJedi2;
     PhaseTournoi = pPhaseTournoi;
     Stade = pStade;
 }
Example #25
0
 private Pokemon[] JouerPhaseTournoi(Pokemon[] tablpokemon, EPhaseTournoi phase)
 {
     Pokemon[] pokevainqueur = new Pokemon[(int)((tablpokemon.Length) / 2)];
     for (int i = 0; i < (tablpokemon.Length) / 2; i++)
     {
         Stade stade = getRandomStade();
         Match match = new Match(tablpokemon[i * 2], tablpokemon[(i * 2) + 1], stade, phase);
         match.JouerMatch();
         Matchs.Add(match);
         pokevainqueur[i] = match.Vainqueur;
     }
     return(pokevainqueur);
 }
        /// <summary>
        /// Adapte un Stade Contract en Stade.
        /// </summary>
        /// <param name="stadeC">Stade Contract à adapter.</param>
        /// <returns>Stade.</returns>
        public static Stade fromStadeContract(StadeContract stadeC)
        {
            if (stadeC == null)
                return null;

            Stade s = new Stade(stadeC.ID,
                                stadeC.Nom,
                                stadeC.NbPlaces,
                                stadeC.Planete,
                                CaracteristiqueAdapter.fromCaracteristiqueContractList(stadeC.Caracteristiques),
                                "");

            return s;
        }
Example #27
0
        public StadeWCF(Stade s)
        {
            Id = s.Id;
            nbPlaces = s.NbPlaces;
            Planet = s.Planete;

            if (s.Caracteristiques != null) {
                Caracteristiques = new List<CaracteristiqueWCF>();
                foreach (Caracteristique c in s.Caracteristiques) {
                    Caracteristiques.Add(new CaracteristiqueWCF(c));
                }
            }
            else
                Caracteristiques = null;
        }
Example #28
0
        public ViewModelStade(Stade stade)
        {
            this.stade = stade;

            /*this.force = (from force in jedi.Carac
             *            where force.Nom == "Force"
             *            select force.Valeur).FirstOrDefault();
             * this.chance = (from chance in jedi.Carac
             *             where chance.Nom == "Chance"
             *             select chance.Valeur).FirstOrDefault();
             *
             * this.sante = (from sante in jedi.Carac
             *            where sante.Nom == "Sante"
             *            select sante.Valeur).FirstOrDefault();
             * this.defense = (from def in jedi.Carac
             *              where def.Nom == "Defense"
             *              select def.Valeur).FirstOrDefault();
             *
             * this.sith = jedi.IsSith;
             * this.nom = jedi.Nom;*/
        }
Example #29
0
 public void getUpdateStadesTest()
 {
     int taille = 0;
     int debTaille = 0;
     List<Stade> liste = bdd.getStades();
     debTaille = liste.Count;
     Assert.AreNotEqual<int>(liste.Count, 0);
     if (liste.Count > 0)
     {
         Stade j = new Stade(0, 999, "Planete Test", new List<Caracteristique>() { bdd.getCaracteristiques().First() });
         liste.Add(j);
         bdd.updateStades(liste);
         taille = liste.Count;
         liste = bdd.getStades();
         Assert.AreEqual<int>(taille, liste.Count);
         Assert.AreNotEqual<int>(0, (liste.Where(x => x.Planete == j.Planete)).ToList().Count);
         liste.Remove(liste.Last());
         bdd.updateStades(liste);
         Assert.AreEqual(debTaille, bdd.getStades().Count);
     }
 }
        public void testMatch()
        {
            Jedi jedi1 = new Jedi();
            Jedi jedi2 = new Jedi();
            Stade stade = new Stade(42, "Test", 42000, "Tata Ouine", null, null);
            Stade stade2 = new Stade(18, "Test2", 2000, "Ouine", null, null);

            Match match = new Match(42, jedi1, jedi2, EPhaseTournoi.Finale, stade);
            Assert.AreEqual(match.ID, 42);
            Assert.AreEqual(match.Jedi1, jedi1);
            Assert.AreEqual(match.Jedi2, jedi2);
            Assert.AreEqual(match.PhaseTournoi, EPhaseTournoi.Finale);
            Assert.AreEqual(match.Stade, stade);

            match.Jedi1 = jedi2;
            match.Jedi2 = jedi1;
            match.PhaseTournoi = EPhaseTournoi.DemiFinale;
            match.Stade = stade2;

            Assert.AreEqual(match.Jedi1, jedi2);
            Assert.AreEqual(match.Jedi2, jedi1);
            Assert.AreEqual(match.PhaseTournoi, EPhaseTournoi.DemiFinale);
            Assert.AreEqual(match.Stade, stade2);
        }
        public List<Caracteristique> getStadeCaracs(Stade stade)
        {
            List<Caracteristique> listCarac = new List<Caracteristique>();

            using (SqlConnection sqlConnection = new SqlConnection(m_connexionString))
            {
                SqlCommand sqlCommandCarac = new SqlCommand("SELECT c.id, c.nom, c.definition, c.type, c.valeur FROM dbo.caracteristique c JOIN carac_stade cs ON cs.id_carac=c.id WHERE c.type='Stade' AND cs.id_stade=" + stade.ID, sqlConnection);
                sqlConnection.Open();
                SqlDataReader sqlDataReaderCarac = sqlCommandCarac.ExecuteReader();

                while (sqlDataReaderCarac.Read())
                {
                    EDefCaracteristique definition = (EDefCaracteristique)Enum.Parse(typeof(EDefCaracteristique), sqlDataReaderCarac.GetString(2));
                    ETypeCaracteristique type = (ETypeCaracteristique)Enum.Parse(typeof(ETypeCaracteristique), sqlDataReaderCarac.GetString(3));

                    listCarac.Add(new Caracteristique(sqlDataReaderCarac.GetInt32(0), sqlDataReaderCarac.GetString(1), definition, type, sqlDataReaderCarac.GetInt32(4)));
                }

                sqlConnection.Close();
            }

            return listCarac;
        }
        public void delStade(Stade stade)
        {
            List<Match> listMatch = getAllMatchs().Where(m => m.Stade.ID == stade.ID).ToList();
            if (listMatch != null)
            {
                foreach (Match m in listMatch)
                {
                    delMatch(m);
                }
            }

            using (SqlConnection sqlConnection = new SqlConnection(m_connexionString))
            {
                SqlCommand sqlDelStade = new SqlCommand("DELETE FROM dbo.stade WHERE id=" + stade.ID, sqlConnection);
                sqlDelStade.Connection = sqlConnection;
                sqlConnection.Open();
                sqlDelStade.ExecuteNonQuery();
                sqlConnection.Close();
            }
        }
        public void TestCreateDeleteStades()
        {
            DalManager manager = new DalManager();
            List<Stade> list1 = manager.getStades();

            Stade newStade = new Stade(12, 1000, "PlaneteTest", null);

            manager.InsertStade(newStade);
            List<Stade> listTemp = list1;
            listTemp.Add(newStade);

            List<Stade> list2 = manager.getStades();
            Assert.AreEqual(listTemp.Count, list2.Count);
            Assert.AreEqual(list1[listTemp.Count - 1].ID, list2[list2.Count - 1].ID);
            Assert.AreEqual(list1[listTemp.Count - 1].NbPlaces, list2[list2.Count - 1].NbPlaces);
            Assert.AreEqual(list1[listTemp.Count - 1].Planete, list2[list2.Count - 1].Planete);

            manager.DeleteStades(newStade);
            list2 = manager.getStades();
            Assert.AreEqual(list1.Count, list2.Count);
            Assert.AreEqual(list1[list1.Count - 1].ID, list2[list2.Count - 1].ID);
            Assert.AreEqual(list1[list1.Count - 1].NbPlaces, list2[list2.Count - 1].NbPlaces);
            Assert.AreEqual(list1[list1.Count - 1].Planete, list2[list2.Count - 1].Planete);
        }
Example #34
0
        public void TestDelStade()
        {
            Stade toto = new Stade(42, "Test", 42000, "Tata Ouine", null, null);
            DalManager m_data = DalManager.Instance;
            m_data.addStade(toto);
            List<Stade> list = m_data.getAllStades().Where(s => s.Nom == toto.Nom && s.NbPlaces == toto.NbPlaces && s.Planete == toto.Planete).ToList();
            m_data.delStade(list.ElementAt(0));

            List<Stade> list2 = m_data.getAllStades().Where(s => s.Nom == toto.Nom && s.NbPlaces == toto.NbPlaces && s.Planete == toto.Planete).ToList();
            Assert.IsTrue(!list2.Any(s => string.IsNullOrEmpty(s.Nom)));
        }
        public ViewModelStade(Stade stade)
        {
            this.stade = stade;
            /*this.force = (from force in jedi.Carac
                          where force.Nom == "Force"
                          select force.Valeur).FirstOrDefault();
            this.chance = (from chance in jedi.Carac
                           where chance.Nom == "Chance"
                           select chance.Valeur).FirstOrDefault();

            this.sante = (from sante in jedi.Carac
                          where sante.Nom == "Sante"
                          select sante.Valeur).FirstOrDefault();
            this.defense = (from def in jedi.Carac
                            where def.Nom == "Defense"
                            select def.Valeur).FirstOrDefault();

            this.sith = jedi.IsSith;
            this.nom = jedi.Nom;*/

        }
        public void modStade(Stade stade)
        {
            string commande = "";

            List<Caracteristique> caracs_prev = getStadeCaracs(stade); //.Where(c => c.ID == jedi.ID).ToList();

            foreach (Caracteristique c in stade.Caracteristiques)
            {
                if (!caracs_prev.Contains(c))
                {
                    commande += "; INSERT INTO carac_stade (id_stade, id_carac) VALUES (" + stade.ID + "," + c.ID + ")";
                }
            }
            foreach (Caracteristique cprev in caracs_prev)
            {
                if (!stade.Caracteristiques.Contains(cprev))
                {
                    commande += "; DELETE FROM carac_stade WHERE id_stade=" + stade.ID + " AND id_carac=" + cprev.ID;
                }
            }

            using (SqlConnection sqlConnection = new SqlConnection(m_connexionString))
            {
                stade.Nom = stade.Nom.Replace("'","''");
                stade.Planete = stade.Planete.Replace("'", "''");
                SqlCommand sqlModStade = new SqlCommand("UPDATE dbo.stade SET nom='" + stade.Nom + "', nbPlaces=" + stade.NbPlaces + ", planete='" + stade.Planete + "', image='" + stade.Image+"' WHERE id=" + stade.ID + "" + commande, sqlConnection);
                sqlModStade.Connection = sqlConnection;
                sqlConnection.Open();
                sqlModStade.ExecuteNonQuery();
                sqlConnection.Close();
            }
        }
        public void addStade(Stade stade)
        {
            string commande = "";

            List<Caracteristique> carac = stade.Caracteristiques;
            if (carac != null)
            {
                foreach (Caracteristique c in carac)
                {
                    addCarac(c);
                    commande += "; INSERT INTO dbo.carac_stade (id_stade, id_carac) VALUES ((SELECT IDENT_CURRENT( 'stade' ))," + c.ID + ")";
                }
            }

            using (SqlConnection sqlConnection = new SqlConnection(m_connexionString))
            {
                stade.Nom = stade.Nom.Replace("'", "''");
                stade.Planete = stade.Planete.Replace("'", "''");
                SqlCommand sqlAddStade = new SqlCommand("INSERT INTO dbo.stade (nom, nbPlaces, planete, image) VALUES ('" + stade.Nom+"', " + stade.NbPlaces + ", '" + stade.Planete + "', '" + stade.Image + "')" + commande, sqlConnection);
                sqlAddStade.Connection = sqlConnection;
                sqlConnection.Open();
                sqlAddStade.ExecuteNonQuery();
                sqlConnection.Close();
            }
        }
 protected void OnRemoveStade(Stade s)
 {
     if (this.RemoveStade != null)
         this.RemoveStade(this, new StadeEventArgs(s));
 }
Example #39
0
        public void TestModTournoi()
        {
            DalManager m_data = DalManager.Instance;

            Jedi jedi1 = new Jedi();
            Jedi jedi2 = new Jedi();
            Stade stade1 = new Stade(12, "Test", 2000, "Tata Win", null, null);
            Stade stade2 = new Stade(13, "Test2", 4000, "Tonton Lose", null, null);
            m_data.addJedi(jedi1);
            m_data.addJedi(jedi2);
            m_data.addStade(stade1);
            m_data.addStade(stade2);

            List<Stade> list1 = m_data.getAllStades().Where(s => (s.Nom == stade1.Nom && s.NbPlaces == stade1.NbPlaces && s.Planete == stade1.Planete) || (s.Nom == stade2.Nom && s.NbPlaces == stade2.NbPlaces && s.Planete == stade2.Planete)).ToList();
            List<Jedi> list2 = m_data.getAllJedis().Where(j => (j.Nom == jedi1.Nom || j.Nom == jedi2.Nom)).ToList();
            Match match1 = new Match(42, list2.ElementAt(0), list2.ElementAt(1), EPhaseTournoi.Finale, list1.ElementAt(0));
            Match match2 = new Match(42, list2.ElementAt(0), list2.ElementAt(1), EPhaseTournoi.Finale, list1.ElementAt(1));
            m_data.addMatch(match1);
            m_data.addMatch(match2);

            List<Match> listMatchs = m_data.getAllMatchs().Where(m => m.Jedi1.ID == list2.ElementAt(0).ID && m.Jedi2.ID == list2.ElementAt(1).ID && (m.Stade.ID == list1.ElementAt(0).ID || m.Stade.ID == list1.ElementAt(1).ID)).ToList();

            Tournoi toto = new Tournoi(27, "Le Premier Tournoi", listMatchs);
            m_data.addTournoi(toto);
            List<Tournoi> list = m_data.getAllTournois().Where(t => t.Nom == toto.Nom).ToList();
            List<Match> listMatchs2 = m_data.getAllMatchs().Where(m => m.Jedi1.ID == list2.ElementAt(0).ID && m.Jedi2.ID == list2.ElementAt(1).ID && m.Stade.ID == list1.ElementAt(0).ID).ToList();
            list.ElementAt(0).Matchs = listMatchs2;
            list.ElementAt(0).Nom = "SecondTournoi";
            m_data.modTournoi(list.ElementAt(0));
            List<Tournoi> list5 = m_data.getAllTournois().Where(t => t.Nom == list.ElementAt(0).Nom).ToList();

            Assert.AreEqual(list.ElementAt(0).Nom, list5.ElementAt(0).Nom);
            m_data.delTournoi(list5.ElementAt(0));
            m_data.delMatch(listMatchs.ElementAt(0));
            m_data.delMatch(listMatchs.ElementAt(1));
            m_data.delStade(list1.ElementAt(0));
            m_data.delStade(list1.ElementAt(1));
            m_data.delJedi(list2.ElementAt(0));
            m_data.delJedi(list2.ElementAt(1));
        }
        /// <summary>
        /// Ajoute un nouveau stade à la liste de stades.
        /// </summary>
        private void New()
        {
            Stade j = new Stade(_newNextId--, "<New>", 0, "<Planete>", null, "");

            this.SelectedItem = new StadeViewModel(j);
            Stades.Add(this.SelectedItem);
        }
Example #41
0
        public void TestAddStade()
        {
            Stade toto = new Stade(42, "Test", 42000, "Tata Ouine", null, null);
            DalManager m_data = DalManager.Instance;
            m_data.addStade(toto);
            List<Stade> list = m_data.getAllStades().Where(s => s.Nom == toto.Nom && s.NbPlaces == toto.NbPlaces && s.Planete == toto.Planete).ToList();

            Assert.AreEqual(toto.Nom, list.ElementAt(0).Nom);
            Assert.AreEqual(toto.NbPlaces, list.ElementAt(0).NbPlaces);
            Assert.AreEqual(toto.Planete, list.ElementAt(0).Planete);
            m_data.delStade(list.ElementAt(0));
        }
 public StadeEventArgs(Stade s)
 {
     _stade = s;
 }