Ejemplo n.º 1
0
        public void GetAllSchools()
        {
            // Setup
            var schoolRepository = new SchoolRepository(SchoolMachineContext);
            // Test Logic
            var schools = schoolRepository.GetAllSchools().Result;

            // Assertions
            Assert.IsTrue(schools.Count() >= DataSeeder.SchoolSeeder.Objects.Count()
                          , string.Format("Database has {0} Schools and Seeder has {1}", schools.Count(), DataSeeder.SchoolSeeder.Objects.Count()));
        }
Ejemplo n.º 2
0
        public void StudentsBySchool()
        {
            // Setup
            var schoolStudentRepository = new SchoolStudentRepository(SchoolMachineContext);
            var schoolRepository        = new SchoolRepository(SchoolMachineContext);
            var seededSchool            = DataSeeder.SchoolSeeder.Objects.FirstOrDefault();

            Assert.IsTrue(seededSchool != null, "No schools were setup in the data seeder.");
            var seededSchoolStudents = DataSeeder.SchoolStudents.Where(s => s.SchoolId == seededSchool.Id);
            var school = schoolRepository.GetAllSchools().Result.FirstOrDefault();

            Assert.IsTrue(school != null, "No schools were saved to the database by the data seeder.");
            // Test Logic
            var students = schoolStudentRepository.StudentsBySchool(school.Id).Result;

            // Assertions
            Assert.IsTrue(students.Count() >= seededSchoolStudents.Count(), string.Format("DataSeeder has {0} SchoolStudents and only found {1}", seededSchoolStudents.Count(), students.Count()));
        }