test case 1 (main assignment):
typetest("school.University");
typetest("school.Faculty");
typetest("school.Department");
typetest("school.Course");
typetest("school.Student");
test case 2 (main assignment):
new school.Student( "fname", "lastname" );
test case 3 (main assignment):
Type type = Type.GetType("school.Student");
MethodInfo enterGrade = type.GetMethod("enterGrade");
Student st = new Student("Alan", "Turing");
st.enterGrade.Invoke( new school.Course("c1"), 21 );
st.enterGrade.Invoke( new school.Course("c2"), 22 );
double result = st.calculateAverage();
if (result != 21.5)
throw new Exception("Average of 21 and 22 Should be 21.5");
Test case 4 (bonus mark):
Faculty scienceFac = University.createFaculty("Science");
Faculty engineeringFac = University.createFaculty("Engineering");
if (University.numberOfFaculties()!=2)
throw new Exception( "I was expecting two faculties to be created ");
Test case five (bonus mark):
Faculty scienceFac = University.createFaculty("Science");
Department compSciDept = scienceFac.openNewDepartment("Physics");
if(!Object.ReferenceEquals(
scienceFac, physicsDept.Faculty))
throw new Exception("Failed to set the field faculty"+
"in the Department object in the method openNewDepartment");
Test case six (bonus mark):
Faculty scienceFac = University.createFaculty("Science");
Department compSciDept = scienceFac.openNewDepartment("Computer Science");
Student st1 = new Student("Alan", "Turing");
compSciDept.addStudent(st1);
if (!Object.ReferenceEquals(compSciDept, st1.Department))
throw new Exception("Failed to set the field department" +
"in the Student object in the method Department.addStudent(...)");