public void VerifierReponseTest() { // Création d’un test List <string> reponsesTest = new List <string> { "31221", "31322", "32131" }; TestAttentionConcentration target = new TestAttentionConcentration(reponsesTest); // Paramètres string reponse = "3"; int numQuestion = 2; // Réel et attendu List <string> expected = new List <string> { "2", "3" }; List <string> actual = target.VerifierReponse(reponse, numQuestion); // Vérifications Assert.AreEqual(expected.Count, actual.Count); for (int i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public void CalculerResultatTest() { // Création d’un test List <string> reponsesTest = new List <string> { "31221", "31322", "32131" }; TestAttentionConcentration target = new TestAttentionConcentration(reponsesTest); // Paramètres target.VerifierReponse("3", 0); target.VerifierReponse("1", 1); target.VerifierReponse("3", 2); target.VerifierReponse("2", 3); target.VerifierReponse("1", 4); target.VerifierReponse("3", 5); target.VerifierReponse("2", 6); target.VerifierReponse("3", 7); target.VerifierReponse("1", 8); target.VerifierReponse("2", 9); target.VerifierReponse("3", 10); target.VerifierReponse("3", 11); target.VerifierReponse("1", 12); target.VerifierReponse("3", 13); target.VerifierReponse("1", 14); // Réel et attendu double expected = 73.33; double actual = target.CalculerResultat(); // Vérification Assert.AreEqual(expected, actual); }
private void Test2Facile_Button_Click(object sender, EventArgs e) { try { TestAttentionConcentration test = new TestAttentionConcentration(false); TestDemonstration_Form testDemoAttention = new TestDemonstration_Form(test); this.Hide(); if (testDemoAttention.ShowDialog() == DialogResult.OK) { TestAttention_Form testAttention = new TestAttention_Form(test); if (testAttention.ShowDialog() == DialogResult.OK) { this.Show(); } } else { this.Show(); } } catch (Exception) { MessageBox.Show("Une erreur est survenue lors de la génération du test…", "Erreur !", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
public void AfficherErreurTest() { // Création d’un test List <string> reponsesTest = new List <string> { "31221", "31322", "32131" }; TestAttentionConcentration target = new TestAttentionConcentration(reponsesTest); // Paramètres List <string> erreur = new List <string> { "2", "3" }; // Réel et attendu string expected = "Vous avez cliqué sur le bouton 3 au lieu du bouton 2."; string actual = target.AfficherErreur(erreur); // Vérification Assert.AreEqual(expected, actual); }
private int decompte; // Pour faire le décompte pour l’affichage des questions // Constructeur du test d’attention (enchaînement des questions) public TestAttention_Form(TestAttentionConcentration testRecu) { InitializeComponent(); this.test = testRecu; }