Esempio n. 1
0
        public async Task can_get_courses_in_a_class_without_duplicates()
        {
            await classRepository.EnrollStudentAsync(tim.StudentId, mathClass.ClassId, math1010.CourseId);

            var courses = await courseRepository.GetCoursesByClassId(mathClass.ClassId);

            courses.Count().Should().Be(2);
            courses.Select(c => c.CourseId).Should().Contain(math1010.CourseId);
            courses.Select(c => c.CourseName).Should().Contain(math1010.CourseName);
            courses.Select(c => c.CourseId).Should().Contain(science1010.CourseId);
            courses.Select(c => c.CourseName).Should().Contain(science1010.CourseName);
        }
Esempio n. 2
0
        private async Task seedDatbase()
        {
            sam = new Student()
            {
                StudentName = "sam"
            };
            jim = new Student()
            {
                StudentName = "jim"
            };
            await studentRepository.AddStudentAsync(sam);

            await studentRepository.AddStudentAsync(jim);

            samsNote = new Note()
            {
                Content = "sam's note"
            };
            await studentRepository.AddUnsignedNoteAsync(sam, samsNote);

            var mathRoom = new ClassRoom()
            {
                ClassRoomName = "Math room"
            };
            await classRepository.AddClassRoomAsync(mathRoom);

            jonathan = new Teacher()
            {
                TeacherName = "jonathan"
            };
            await classRepository.AddTeacherAsync(jonathan);

            math1010 = new Course()
            {
                CourseName = "math 1010",
                TeacherId  = jonathan.TeacherId
            };
            await courseRepository.AddCourseAsync(math1010);

            mathClass = new ClassModel()
            {
                ClassName   = "Math in the afternoon",
                ClassRoomId = mathRoom.ClassRoomId,
                TeacherId   = jonathan.TeacherId
            };
            await classRepository.AddClassAsync(mathClass);

            await classRepository.EnrollStudentAsync(sam.StudentId, mathClass.ClassId, math1010.CourseId);

            await classRepository.EnrollStudentAsync(jim.StudentId, mathClass.ClassId, math1010.CourseId);
        }
Esempio n. 3
0
        private async Task seedDatabase()
        {
            scienceRoom = new ClassRoom()
            {
                ClassRoomName     = "Science Room",
                SeatsHorizontally = 10,
                SeatsVertically   = 8
            };
            jonathan = new Teacher()
            {
                TeacherName = "jonathan"
            };
            sam = new Student()
            {
                StudentName = "sam"
            };
            ben = new Student()
            {
                StudentName = "ben"
            };
            tim = new Student()
            {
                StudentName = "tim"
            };
            await classRepository.AddClassRoomAsync(scienceRoom);

            await classRepository.AddTeacherAsync(jonathan);

            await studentRepository.AddStudentAsync(sam);

            await studentRepository.AddStudentAsync(ben);

            await studentRepository.AddStudentAsync(tim);

            mathClass = new ClassModel()
            {
                ClassName   = "math",
                TeacherId   = jonathan.TeacherId,
                ClassRoomId = scienceRoom.ClassRoomId
            };
            await classRepository.AddClassAsync(mathClass);

            math1010 = new Course()
            {
                CourseName = "math 1010",
                TeacherId  = jonathan.TeacherId
            };
            science1010 = new Course()
            {
                CourseName = "science 1010",
                TeacherId  = jonathan.TeacherId
            };
            await courseRepository.AddCourseAsync(math1010);

            await courseRepository.AddCourseAsync(science1010);

            await classRepository.EnrollStudentAsync(sam.StudentId, mathClass.ClassId, math1010.CourseId);

            await classRepository.EnrollStudentAsync(ben.StudentId, mathClass.ClassId, science1010.CourseId);

            await classRepository.EnrollStudentAsync(tim.StudentId, mathClass.ClassId, science1010.CourseId);
        }