public FormTanuloKornyezetismeret() { InitializeComponent(); this.answerButtons = new Button[AnswerButtonCount]; this.answerButtons[0] = this.answerButton1; this.answerButtons[1] = this.answerButton2; this.answerButtons[2] = this.answerButton3; this.answerButtons[3] = this.answerButton4; EnvironmentalQuestionsManager manager = new EnvironmentalQuestionsManager(); this.list = manager.SelectAll(); this.currentQuestion = 0; Action <object, MouseEventArgs> answerClicked = (obj, e) => { int correctIndex = this.list[this.currentQuestion].Answers.FindIndex((x) => x.IsCorrect); if (obj.Equals(this.answerButtons[correctIndex])) { //Jó válasz User.CurrentUser.Score += this.list[this.currentQuestion].Score; } else { //Helytelen válasz MessageBox.Show("Helytelen válasz!", "HIBA", MessageBoxButtons.OK); } this.GetNextQuestion(); }; }
public void EnvironmentalQuestionsAll() { EnvironmentalQuestion expected = new EnvironmentalQuestion(); expected.Text = "test"; expected.Score = 2; expected.Answers = new List <EnvironmentalAnswer>() { new EnvironmentalAnswer("valasz1", false), new EnvironmentalAnswer("valasz2", false), new EnvironmentalAnswer("valasz3", true), new EnvironmentalAnswer("valasz4", false) }; EnvironmentalQuestionsManager manager = new EnvironmentalQuestionsManager(); EnvironmentalQuestion actual = manager.Select(2); Assert.AreEqual(expected, actual); }