예제 #1
0
        public void SelectClosedQuestionsTest()
        {
            //Arrange
            mockMethod.mockDataIntoDB();
            ExamsController ExamsController            = new ExamsController();
            int             AmountOfSelecetedQuestions = 4;
            int             courseID = 1;


            UseSqlite();
            using (var context = GetDBContext())
            {
                Course SelectedCourse = context.Course
                                        .Include(c => c.ClosedQuestionsList)
                                        .Include(q => q.OpenedQuestionsList)
                                        .Where(course => course.CourseID == courseID)
                                        .Select(seleceteCourse => seleceteCourse).Single();

                //Act
                var CQuestions = SelectedCourse.ClosedQuestionsList.DistinctBy(q => q.Question).ToList();
                CQuestions = ExamsController.SelectClosedQuestions(CQuestions, AmountOfSelecetedQuestions);

                //Assert
                Assert.Equal(4, CQuestions.Count());
            }
        }