public async Task GetTestSummaryDetailsAsyncTest()
        {
            var category1 = CreateCategory("history");
            await _categoryRepository.AddCategoryAsync(category1);

            var category2 = CreateCategory("indian culture");
            await _categoryRepository.AddCategoryAsync(category2);

            var testCategoryList = new List <TestCategoryAC>
            {
                new TestCategoryAC()
                {
                    IsSelect   = true,
                    CategoryId = category1.Id
                },
                new TestCategoryAC()
                {
                    IsSelect   = true,
                    CategoryId = category2.Id
                }
            };

            //Creating questions
            var question1 = CreateQuestionAC(true, "Who was the father of Humayun ?", category1.Id, 0);
            var question2 = CreateQuestionAC(true, "Bharatnatyam is a popular dance form of which state ?", category2.Id, 0);
            await _questionRepository.AddSingleMultipleAnswerQuestionAsync(question1, "5");

            await _questionRepository.AddSingleMultipleAnswerQuestionAsync(question2, "5");

            var allQuestions = await _questionRepository.GetAllQuestionsAsync("5", 0, 0, "All", null);

            var test = CreateTest("General Awareness");
            await _testRepository.CreateTestAsync(test, "5");

            //Adding categories to test
            await _testRepository.AddTestCategoriesAsync(test.Id, testCategoryList);

            var qtestQuestionList  = new List <TestQuestionAC>();
            var questionDetailList = Mapper.Map <List <QuestionDetailAC> >(allQuestions.ToList());

            foreach (var question in allQuestions.ToList())
            {
                var testQuestion = new TestQuestionAC();
                testQuestion.IsSelect   = true;
                testQuestion.CategoryID = question.CategoryID;
                testQuestion.Id         = question.Id;
                qtestQuestionList.Add(testQuestion);
            }
            await _testRepository.AddTestQuestionsAsync(qtestQuestionList, test.Id);

            var questionCount = await _testConductRepository.GetTestSummaryDetailsAsync(test.Link);

            Assert.Equal(2, questionCount);
        }
Exemple #2
0
        public async Task <int> GetTestSummaryAsync(string testLink)
        {
            var summaryDetails = await _testConductRepository.GetTestSummaryDetailsAsync(testLink);

            return(summaryDetails);
        }