public void TesteUnitaireCréationSondage() { ReponseSondage Reponse = new ReponseSondage("UnitTest1"); ReponseSondage Reponse1 = new ReponseSondage("UnitTest2"); ReponseSondage Reponse2 = new ReponseSondage("UnitTest3"); List <ReponseSondage> ListeDeReponse = new List <ReponseSondage>(); ListeDeReponse.Add(Reponse); ListeDeReponse.Add(Reponse1); ListeDeReponse.Add(Reponse2); ClasseSondage sondage = new ClasseSondage("Creation d'un sondage UniTest", ListeDeReponse, false); int idUnitest = DataAcces.CreerUnSondage(sondage); ClasseSondage SondageUniTest = DataAcces.RecupererSondageEnBDD(idUnitest); Assert.IsTrue(SondageUniTest.QuestionChoixMultiples == false, "le choixmultiple n'as pas été pris en compte"); }
public void TesteUnitaireLesReponsesDuSondage() { ReponseSondage Reponse = new ReponseSondage("UnitTest1"); ReponseSondage Reponse1 = new ReponseSondage("UnitTest2"); ReponseSondage Reponse2 = new ReponseSondage("UnitTest3"); List <ReponseSondage> ListeDeReponse = new List <ReponseSondage>(); ListeDeReponse.Add(Reponse); ListeDeReponse.Add(Reponse1); ListeDeReponse.Add(Reponse2); ClasseSondage sondage = new ClasseSondage("Creation d'un sondage UniTest", ListeDeReponse, false); int idUnitest = DataAcces.CreerUnSondage(sondage); ClasseSondage SondageUniTest = DataAcces.RecupererSondageEnBDD(idUnitest); Assert.IsTrue(SondageUniTest.ListeDeReponse[0].Reponse == "UnitTest1" && SondageUniTest.ListeDeReponse[1].Reponse == "UnitTest2" && SondageUniTest.ListeDeReponse[2].Reponse == "UnitTest3", "la Question du Sondage n'as pas été correctement Enregistrer"); }
public ActionResult CreationSondage(string Question, List <string> Reponse, string CheckBox) { List <ReponseSondage> ListeDeQuestions = ClasseSondage.GetlisteDeReponses(Reponse); bool choix = FonctionUtiles.Choixmultiple(CheckBox); ClasseSondage classeSondage = new ClasseSondage(Question, ListeDeQuestions, choix); int IDSondage = DataAcces.CreerUnSondage(classeSondage); ClasseSondage SondageCourant = DataAcces.RecupererSondageEnBDD(IDSondage); //on écrit new pius le nom du parametre du controller qu'on aimerais ateindre = à la valeur qu'on aimerais intégrer return(RedirectToAction("SondageLiensDeGestion", new { id = IDSondage, Clef = SondageCourant.ClefDeSupression })); }
public void TesteDesactivationSondage() { ReponseSondage Reponse = new ReponseSondage("UnitTest1"); ReponseSondage Reponse1 = new ReponseSondage("UnitTest2"); ReponseSondage Reponse2 = new ReponseSondage("UnitTest3"); List <ReponseSondage> ListeDeReponse = new List <ReponseSondage>(); ListeDeReponse.Add(Reponse); ListeDeReponse.Add(Reponse1); ListeDeReponse.Add(Reponse2); ClasseSondage sondage = new ClasseSondage("Creation d'un sondage UniTest", ListeDeReponse, false); int idUnitest = DataAcces.CreerUnSondage(sondage); DataAcces.DesactivationSondage(idUnitest); ClasseSondage SondageUniTest = DataAcces.RecupererSondageEnBDD(idUnitest); Assert.IsTrue(SondageUniTest.EtatDuSondage == false, "le sondage n'as pas été désactivé"); }