public static RandomQuestion GenerateRandomQuestion() { var qa = RandomQuestions.CreateRandomQuestions(); var random = new Random(); var index = random.Next(qa.Count); return(qa[index]); }
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); }