Esempio n. 1
0
        public async Task GetTestInstructionsAsyncTest()
        {
            //Creating test
            var test = await CreateTestAsync();

            //Creating test category
            var category1 = CreateCategory("Mathematics");
            await _categoryRepository.AddCategoryAsync(category1);

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

            var category3 = CreateCategory("History");
            await _categoryRepository.AddCategoryAsync(category3);

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

            await _testRepository.AddTestCategoriesAsync(test.Id, testCategoryAC);

            //Creating test questions
            var questionList = new List <QuestionAC>
            {
                CreateQuestionAC(true, "Category1 type question", category1.Id, 1),
                CreateQuestionAC(false, "Category1 type question", category1.Id, 2),
                CreateQuestionAC(true, "Category3 type question", category3.Id, 3),
                CreateQuestionAC(true, "Category3 type question", category3.Id, 4),
            };
            var testQuestionList = new List <TestQuestionAC>();

            questionList.ForEach(x =>
            {
                var testQuestion        = new TestQuestionAC();
                testQuestion.CategoryID = x.Question.CategoryID;
                testQuestion.Id         = x.Question.Id;
                testQuestion.IsSelect   = x.Question.IsSelect;
                testQuestionList.Add(testQuestion);
            });
            await _testRepository.AddTestQuestionsAsync(testQuestionList, test.Id);

            var testInstruction = await _testConductRepository.GetTestInstructionsAsync(_stringConstants.MagicString);

            Assert.NotNull(testInstruction);
        }
Esempio n. 2
0
        public async Task <TestInstructionsAC> GetTestInstructionsAsync(string testLink)
        {
            await HttpContext.Session.LoadAsync();

            HttpContext.Session.SetString(_stringConstants.Path, "instructions");
            var result = await _testConductRepository.GetTestInstructionsAsync(testLink);

            return(result);
        }