Exemplo n.º 1
0
        private static void AddQuestion(Test test, int number)
        {
            var newQuestion = new Question
            {
                Text   = Console.GetInput(TextForOutput.EnterQuestionText),
                Number = number
            };

            if (test.IsClosedQuestions)
            {
                var answersNumber = Console.GetIntValue(TextForOutput.EnterAnswersNumber);

                for (var j = 0; j < answersNumber; j++)
                {
                    newQuestion.Answers.Add(Console.GetInput(TextForOutput.EnterAnswer));
                }

                newQuestion.CorrectAnswer =
                    Console.GetIntValue(TextForOutput.EnterCorrectAnswer);

                newQuestion.Score = Console.GetIntValue(TextForOutput.EnterQuestionScore);
            }

            TestService.AddQuestion(test, newQuestion);
        }