Esempio n. 1
0
        public void Update_AddQuestionToExam()
        {
            ServiceTestsHelper helper          = new ServiceTestsHelper();
            ExamCoreService    examCoreService = helper.examCoreService;
            QuestionService    questionService = helper.questionService;

            var exam = new ExamCore()
            {
                Id   = 1,
                Name = "name"
            };
            var question = new Question()
            {
                Id           = 1,
                QuestionText = "Question1"
            };

            examCoreService.Insert(exam);

            examCoreService.AddQuestionToExam(exam, question);
            var addedQuestion = questionService.GetAll().Where(x => x.ExamCoreID == exam.Id).FirstOrDefault();

            Assert.NotNull(addedQuestion);
            Assert.Equal(addedQuestion.QuestionText, "Question1");
        }
Esempio n. 2
0
        public void Insert_ExamCore()
        {
            ServiceTestsHelper helper  = new ServiceTestsHelper();
            ExamCoreService    service = helper.examCoreService;

            var exam = new ExamCore()
            {
                Id   = 1,
                Name = "name"
            };
            var exam2 = new ExamCore()
            {
                Id   = 2,
                Name = "name"
            };
            var exam3 = new ExamCore()
            {
                Id   = 3,
                Name = "name"
            };

            service.Insert(exam);
            service.Insert(exam2);
            service.Insert(exam3);

            var tmp = service.GetAll().ToList();

            Assert.Equal(tmp.Count, 3);
        }
Esempio n. 3
0
        public void Insert_Student()
        {
            ServiceTestsHelper helper         = new ServiceTestsHelper();
            StudentService     studentService = helper.studentService;

            var student = new Student()
            {
                Id   = 1,
                Name = "name"
            };

            studentService.Insert(student);
            var tmp = studentService.GetAll();

            Assert.Equal(tmp.Count, 1);
        }
Esempio n. 4
0
        public void Insert_GetStudentByEmail()
        {
            ServiceTestsHelper helper         = new ServiceTestsHelper();
            StudentService     studentService = helper.studentService;

            var student = new Student()
            {
                Id    = 1,
                Name  = "name",
                Email = "*****@*****.**"
            };

            studentService.Insert(student);
            var tmp = studentService.GetStudentByEmail("*****@*****.**");

            Assert.NotNull(tmp);
            Assert.Equal(tmp.Email, "*****@*****.**");
        }
Esempio n. 5
0
        public void Update_AddQuestionsToExam()
        {
            ServiceTestsHelper helper          = new ServiceTestsHelper();
            ExamCoreService    examCoreService = helper.examCoreService;
            QuestionService    questionService = helper.questionService;

            var exam = new ExamCore()
            {
                Id   = 1,
                Name = "name"
            };
            var question = new Question()
            {
                Id           = 1,
                QuestionText = "Question1"
            };
            var question2 = new Question()
            {
                Id           = 2,
                QuestionText = "Question2"
            };
            var question3 = new Question()
            {
                Id           = 3,
                QuestionText = "Question3"
            };

            examCoreService.Insert(exam);

            examCoreService.AddQuestionsToExam(exam, new List <Question>()
            {
                question, question2, question3
            });

            var addedQuestion = questionService.GetAll().Where(x => x.ExamCoreID == exam.Id).ToList();

            Assert.Equal(addedQuestion.Count, 3);
        }
Esempio n. 6
0
        public void Insert_ExamCore()
        {
            ServiceTestsHelper  helper = new ServiceTestsHelper();
            StudentGroupService studentGroupService = helper.studentGroupService;

            var studentGroup = new StudentGroup()
            {
                Id   = 1,
                Name = "StudentGroup"
            };
            var studentGroup2 = new StudentGroup()
            {
                Id   = 1,
                Name = "StudentGroup2"
            };

            studentGroupService.Insert(studentGroup);
            studentGroupService.Insert(studentGroup2);


            var tmp = studentGroupService.GetAll();

            Assert.Equal(tmp.Count, 1);
        }