Exemple #1
0
 public bool IsValid()
 {
     return(!string.IsNullOrEmpty(Description) &&
            Id != Guid.Empty &&
            Questions != null &&
            Questions.Any() ? Questions.All(s => s.IsValid()) : true);
 }
        public override void AnswerQuestion(IQuestion question, IAnswer answer)
        {
            if (question.State == QuestionState.Unanswered)
            {
                var hitScore = HitScore;

                question.Answer = answer;

                CorrectAnswers   = Questions.Count(o => o.State == QuestionState.Correct);
                IncorrectAnswers = Questions.Count(o => o.State == QuestionState.Incorrect);

                question.AnswerOrder = CorrectAnswers + IncorrectAnswers;

                if (question.State == QuestionState.Correct)
                {
                    TotalScore += hitScore;
                }

                Completed = Questions.All(o => o.State != QuestionState.Unanswered);
            }
        }
Exemple #3
0
 public bool Verify()
 {
     return(Questions.All(verify => verify(this)));
 }
 public bool IsValidForSubmission()
 {
     return((Questions == null || Questions.All(q => q.Optional || !string.IsNullOrEmpty(q.Answer))) &&
            (SubSections == null || SubSections.All(s => s.IsValidForSubmission())));
 }
 public bool IsComplete()
 {
     return((Questions == null || Questions.All(q => !string.IsNullOrEmpty(q.Answer))) &&
            (SubSections == null || SubSections.All(s => s.IsComplete())));
 }