public void SetExamScoreFromClosedQuestionWrongAnswersTest() { //Arrange mockMethod.mockDataIntoDB(); mockMethod.mockExamDataIntoDB(); ExamsController ExamsController = new ExamsController(); List <ClosedQuestions> examCQuestions = new List <ClosedQuestions>(); var QuestionAnswer = new Dictionary <string, string>(); Results examResults; int examID = 1; //Act UseSqlite(); using (var context = GetDBContext()) { examCQuestions = (from ex in context.ExamClosedQuestions where ex.ExamsID == examID select ex.ClosedQuestions).ToList(); examResults = (from ex in context.Results where ex.ExamID == examID select ex).Single(); for (int i = 0; i < examCQuestions.Count(); i++) { QuestionAnswer.Add ( examCQuestions.ElementAt(i).Question, "Wrong Answer" ); // QuestionAnswer.Keys=(examCQuestions.ElementAt(i).Question); // QuestionAnswer.Values.Concat(examCQuestions.ElementAt(i).ProperAnswer); } //QuestionAnswer.Keys = examCQuestions.SelectMany(x=>x.Question); //QuestionAnswer.Values.Concat(examCQuestions.SelectMany(x => x.ProperAnswer)); examResults = ExamsController.SetExamScoreFromClosedQuestionAnswers(examCQuestions, QuestionAnswer, examResults); //Assert Assert.Equal(0, examResults.Score); } }