예제 #1
0
        public static RandomQuestion GenerateRandomQuestion()
        {
            var qa     = RandomQuestions.CreateRandomQuestions();
            var random = new Random();
            var index  = random.Next(qa.Count);

            return(qa[index]);
        }
예제 #2
0
        public static bool ValidateProvidedAnswer(string questionId, string providedAnswer)
        {
            var qa = RandomQuestions.CreateRandomQuestions();

            var lookup = qa.FirstOrDefault(q => q.Id == questionId);

            if (lookup is null)
            {
                return(false);
            }

            var result = string.Equals(lookup.Answer, providedAnswer, StringComparison.OrdinalIgnoreCase);

            return(result);
        }