public void TeachercCanTeachASingleClass()
        {
            var underTest = new Teacher(3);
            underTest.AddClassTitle("Remedial Math");

            Assert.Equal("Remedial Math", underTest.ClassTitles.Single());
        }
        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 AStudentCanRegistorForNewClassOfferings()
        {
            var title = default(string);
            var t = new Teacher(1);


            t.OnClassAdded += (tt, args) => title = args.ClassTitle;

            t.AddClassTitle("A cool class");
            Assert.Equal("A cool class", title);
        }
        public void DuplicateClassIsNotAdded()
        {
            var underTest = new Teacher(3);
            underTest.AddClassTitle("Remedial Math");
            underTest.AddClassTitle("General Math");
            underTest.AddClassTitle("Advanced Math");
            underTest.AddClassTitle("General Math");

            Assert.Equal("Remedial Math", underTest.ClassTitles.First());
            Assert.Equal("General Math", underTest.ClassTitles.Skip(1).First());
            Assert.Equal("Advanced Math", underTest.ClassTitles.Last());
            Assert.Equal(3, underTest.ClassTitles.Count());
        }
        public void TeachercCanTeachMultipleClass()
        {
            var underTest = new Teacher(3);
            underTest.AddClassTitle("Remedial Math");
            underTest.AddClassTitle("General Math");
            underTest.AddClassTitle("Advanced Math");


            Assert.Equal("Remedial Math", underTest.ClassTitles.First());
            Assert.Equal("General Math", underTest.ClassTitles.Skip(1).First());
            Assert.Equal("Advanced Math", underTest.ClassTitles.Last());
            Assert.Equal(3, underTest.ClassTitles.Count());
        }
        public void TeachHasNameAndSubjectAreaAndId()
        {
            var underTest = new Teacher(7)
            {
                FirstName = "Sample",
                LastName = "Teacher",
                SubjectArea = "Maths"
            };

            Assert.Equal(7, underTest.Id);
            Assert.Equal("Maths", underTest.SubjectArea);
            Assert.False(underTest.ClassTitles.Any());

        }
 public ClassOffering(Teacher leadInstructor, Func<string, string, int> gradingFunction)
 {
     this.leadInstructor = leadInstructor;
     this.gradingFunc = gradingFunction;
 }
Exemple #8
0
 public ClassOffering(Teacher leadInstructor, Func <string, string, int> gradingFunction)
 {
     this.leadInstructor = leadInstructor;
     this.gradingFunc    = gradingFunction;
 }