示例#1
0
    private void ClickChoice()
    {
        //Save choice to Player
        _p.SelectChoice(_questionScreen[_questNo].SelectedChoice);
        _p.IsCorrect = _generator.CheckAnswer(_generator.ListQuestion[_questNo].QuestID, _p.SelectedChoice);
        _p.CountScore(false);

        //Continue on processing question
        _questNo++;
        _time.Value = 0;
        Remove(_questionScreen[_questNo - 1]);
        if (_questNo < 5)
        {
            Add(_questionScreen[_questNo]);
        }
        else
        {
            GLib.Source.Remove(_idTimer);
            string text = "Let's play again for the tie-break!";
            if (_p.Score < _bot.Score)
            {
                text = "I see your potential! Let's try again!";
            }
            if (_p.Score > _bot.Score)
            {
                text = String.Format("Congratulation, {0}! You defeated the bot! Let's try another level!", _p.Name);
            }
            _resultScreen = new MyQA.view.ResultScreen(text, new string[] { _p.Score.ToString(), _bot.Score.ToString() });
            Add(_resultScreen);
            _resultScreen.ClickPlayAgain += (sender, e) => PlayAgainScreen();
        }
    }
示例#2
0
        public void CheckAnswerTest()
        {
            //Check the answer for question 1
            QAGenerator generator    = new QAGenerator();
            bool        actualResult = generator.CheckAnswer(1, "TAFE Building");

            Assert.IsTrue(actualResult);
        }
示例#3
0
        public void CheckCorrectAnswerTest()
        {
            QAGenerator generator = new QAGenerator();

            generator.LoadQuestion();

            Player p = new Player(generator, "Peter");

            p.SelectChoice("TAFE Building");

            bool actualResult = generator.CheckAnswer(1, p.SelectedChoice);

            Assert.IsTrue(actualResult);
        }