Exemplo n.º 1
0
        private static IDictionary <Word, IList <ProblemMapping> > GetQuestionResults(IQuestion question, IEnumerable <ProblemMapping> problemMappings = null)
        {
            problemMappings = problemMappings ?? ProblemMapping.AllProblemMappings;

            var wordToMapping = WordHelpers.AllWords()
                                .ToDictionary <Word, Word, IList <ProblemMapping> >(word => word, word => new List <ProblemMapping>());

            foreach (var problemMapping in problemMappings)
            {
                var answers = question.GetPossibleAnswers(problemMapping).OrderBy(a => a);
                foreach (var answer in answers)
                {
                    wordToMapping[problemMapping.AnswerMapping[answer]].Add(problemMapping);
                }
            }

            return(wordToMapping);
        }