Пример #1
0
        public async System.Threading.Tasks.Task QuestionnairesByStudentGetSuccesfull()
        {
            var context = TestingUtilities.CreateInMemoryDatabaseContext("TestDatabaseGetQByStudents");
            var q1      = new Questionnaire()
            {
                Id = 3, StudentId = 0, ClassId = 0
            };
            var q2 = new Questionnaire()
            {
                Id = 1, StudentId = 1, ClassId = 0
            };
            var q3 = new Questionnaire()
            {
                Id = 2, StudentId = 1, ClassId = 1
            };
            var correctData = new List <Questionnaire>
            {
                q2, q3
            };

            context.Questionnaires.Add(q1);
            context.Questionnaires.Add(q2);
            context.Questionnaires.Add(q3);
            context.SaveChanges();
            var qController = new QuestionnaireController(context);
            //Act
            var result = await qController.GetQuestionnairesByStudent(new QuestionnaireController.QuestionnaireIdentityArgs {
                ClassId = 0, StudentId = 1
            });

            var resValue = result.Value;

            //Assert
            Assert.Equal(correctData, resValue);
        }