public void AddClassTitle(string title)
 {
     if (!classTitles.Contains(title))
     {
         classTitles.Add(title);
         OnClassAdded?.Invoke(this, new AddClassEventArgs(title, this.SubjectArea));
         var offering = new ClassOffering(this, (assignemt, result) => computePoints(assignemt, result));
         School.Singleton().AddClassOffering(offering);
     }
 }
        public void TeacherGradesHomework()
        {
            bool assigned = false;
            var t = new Teacher(1);
            var offer = new ClassOffering(t, (assignment, name) => { assigned = true; return 5; });

            var s = new Student(2);
            offer.TurnInAssignment(s, "assignment", "result");

            Assert.True(assigned);
        }
        public void AverageOfStudentsGetsComputed()
        {
            var classoffering = new ClassOffering(new Teacher(1), (s1, s2) => 0);

            var s = new Student(1);
            s.RecordClassGrade(Grade.A);
            classoffering.EnrollStudent(s);
            s = new Student(2);
            s.RecordClassGrade(Grade.C);
            classoffering.EnrollStudent(s);

            var gpa = classoffering.AverageGPAForStudents();

            Assert.Equal(3.0, gpa);
        }
 public void AddClassOffering(ClassOffering offering)
 {
     allClasses.Add(offering);
 }
 public void AverageOfZeroStudentsIsZero()
 {
     var classoffering = new ClassOffering(new Teacher(1), (s1, s2) => 0);
     var avg = classoffering.AverageGPAForStudents();
     Assert.Equal(0.0, avg);
 }