Beispiel #1
0
        // Tests GestionCompteJoueur
        private void BtnCompteJoueur_Click(object sender, EventArgs e)
        {
            txtTestes.Clear();
            GestionCompteJoueur gestionCompteJoueur = new GestionCompteJoueur();

            string Message = gestionCompteJoueur.CréerCompteJoueur("LinkTheHero", "*****@*****.**", "Link", "The Hero", 1, "Abc1234!");

            txtTestes.Text += "Test création CompteJoueur...\r\n";
            txtTestes.Text += "\r\n";
            txtTestes.Text += Message + "\r\n";

            txtTestes.Text += "\r\nTest modification CompteJoueur...\r\n";
            txtTestes.Text += "\r\n";

            CompteJoueur compteJoueur = new CompteJoueur()
            {
                NomJoueur       = "Ganon",
                Courriel        = "*****@*****.**",
                Prenom          = "Ganon",
                Nom             = "Bad",
                TypeUtilisateur = 1
            };
            string MotDePasse = "Toto";

            using (EntitiesGEDEquipe1 contexte = new EntitiesGEDEquipe1())
            {
                List <CompteJoueur> compteJoueurs = contexte.CompteJoueurs.ToList();
                compteJoueur.Id = compteJoueurs.Last().Id;
                gestionCompteJoueur.ModifierCompteJoueur(compteJoueur, MotDePasse);
            }
            txtTestes.Text += "SUCCESS\r\n";

            txtTestes.Text += "\r\nTest connexion CompteJoueur...\r\n";
            txtTestes.Text += "\r\n";

            string       testConnexion = "ERROR";
            CompteJoueur compte        = gestionCompteJoueur.ConnexionCompteJoueur("Ganon", "Toto");

            if (compte != null)
            {
                testConnexion = "SUCCESS";
            }

            txtTestes.Text += testConnexion + "\r\n";

            txtTestes.Text += "\r\nTest supression CompteJoueur...\r\n";
            txtTestes.Text += "\r\n";

            using (EntitiesGEDEquipe1 contexte = new EntitiesGEDEquipe1())
            {
                List <CompteJoueur> compteJoueurs = contexte.CompteJoueurs.ToList();
                compteJoueur = compteJoueurs.Last();
                gestionCompteJoueur.SupprimerCompteJoueur(compteJoueur);
            }
            txtTestes.Text += "SUCCESS\r\n";
        }