Exemplo n.º 1
0
        /// <summary>
        /// Adds a classroom gradebook to the database.
        /// </summary>
        public TestDatabaseBuilder AddGradebook(
            string classroomName,
            string gradebookName,
            string sectionName,
            DateTime lastTransferDate)
        {
            var classroom = _buildContext.Classrooms
                            .Single(c => c.Name == classroomName);

            var section = _buildContext.Sections
                          .Where(s => s.Classroom.Name == classroomName)
                          .Single(s => s.Name == sectionName);

            var classroomGradebook = new ClassroomGradebook()
            {
                Name              = gradebookName,
                ClassroomId       = classroom.Id,
                SectionGradebooks = Collections.CreateList
                                    (
                    new SectionGradebook()
                {
                    SectionId        = section.Id,
                    LastTransferDate = lastTransferDate
                }
                                    )
            };

            _buildContext.ClassroomGradebooks.Add(classroomGradebook);
            _buildContext.SaveChanges();

            return(this);
        }
 /// <summary>
 /// Verifies that the section gradebooks in the classroom gradebook
 /// were not duplciated.
 /// </summary>
 private void VerifySectionGradebooks(
     DatabaseContext dbContext,
     ClassroomGradebook oldClassroomGradebook,
     ClassroomGradebook newClassroomGradebook)
 {
     VerifyCollectionNotDuplicated
     (
         dbContext,
         oldClassroomGradebook,
         newClassroomGradebook,
         cg => cg.SectionGradebooks
     );
 }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a classroom gradebook to the database.
        /// </summary>
        public TestDatabaseBuilder AddClassroomGradebook(
            string classroomName,
            string gradebookName)
        {
            var classroom = _buildContext.Classrooms
                            .Single(c => c.Name == classroomName);

            var classroomGradebook = new ClassroomGradebook()
            {
                Name        = gradebookName,
                ClassroomId = classroom.Id
            };

            _buildContext.ClassroomGradebooks.Add(classroomGradebook);
            _buildContext.SaveChanges();

            return(this);
        }