public void AddRecords(Catalog catalog)
        {
            Pupil firstPupil = new Pupil("John Smith");
            Subject mathematics = new Subject("Mathematics");
            mathematics.AddNote(new Note(9.5m));
            mathematics.AddNote(new Note(9m));
            mathematics.AddNote(new Note(10m));
            mathematics.AddNote(new Note(9.5m));
            firstPupil.AddSubject(mathematics);
            Subject literature = new Subject("Literature", new List<Note>() { new Note(8.5m), new Note(10m), new Note(8.5m) });
            firstPupil.AddSubject(literature);
            Subject music = new Subject("Music", new List<Note>() { new Note(9.5m) });
            music.AddNote(new Note(9m));
            music.AddNote(new Note(10m));
            firstPupil.AddSubject(music);
            catalog.AddPupil(firstPupil);

            Pupil secondPupil = new Pupil("Tom Miller");
            catalog.AddPupil(secondPupil);

            Pupil thirdPupil = new Pupil("Paul Allen");
            catalog.AddPupil(thirdPupil);

            Pupil fourthPupil = new Pupil("Sarah Parker");
            catalog.AddPupil(fourthPupil);

            Pupil fifthPupil = new Pupil("Edward Hall");
            fifthPupil.AddSubject(new Subject("Mathematics", new List<Note>() { new Note(10m), new Note(7m), new Note(7m) }));
            catalog.AddPupil(fifthPupil);
        }
        public void TestAddMoreNotes()
        {
            Subject mathematics = new Subject("Mathematics");
            Assert.AreNotEqual(true, mathematics.HasRecords());
            mathematics.AddNote(new Note(9.5m));
            mathematics.AddNote(new Note(10m));
            mathematics.AddNote(new Note(9m));
            Assert.AreEqual(true, mathematics.HasRecords());

            Subject literature = new Subject("Literature", new List<Note>() { new Note(8.5m), new Note(10m), new Note(8.5m) });
            Assert.AreEqual(true, literature.HasRecords());

            Subject music = new Subject("Music", new List<Note>() { new Note(9.5m) });
            music.AddNote(new Note(9m));
            music.AddNote(new Note(10m));
            Assert.AreEqual(true, music.HasRecords());
        }
 public void TestSubjectInit()
 {
     Subject subject = new Subject("Mathematics");
     Assert.AreEqual("Mathematics", subject.Name);
 }
        public void TestPupilsWith10()
        {
            Catalog catalog = new Catalog();
            AddRecords(catalog);
            List<Pupil> pupilsToCompare = catalog.GetPupilsWithTheMost10();

            Pupil firstPupil = new Pupil("John Smith");
            Subject mathematics = new Subject("Mathematics");
            mathematics.AddNote(new Note(9.5m));
            mathematics.AddNote(new Note(9m));
            mathematics.AddNote(new Note(10m));
            mathematics.AddNote(new Note(9.5m));
            firstPupil.AddSubject(mathematics);
            Subject literature = new Subject("Literature", new List<Note>() { new Note(8.5m), new Note(10m), new Note(8.5m) });
            firstPupil.AddSubject(literature);
            Subject music = new Subject("Music", new List<Note>() { new Note(9.5m) });
            music.AddNote(new Note(9m));
            music.AddNote(new Note(10m));
            firstPupil.AddSubject(music);
            List<Pupil> comparerPupils = new List<Pupil>();
            comparerPupils.Add(firstPupil);

            Assert.AreEqual(comparerPupils[0].Name, pupilsToCompare[0].Name);
        }
Exemple #5
0
 public void AddSubject(Subject subject)
 {
     Subjects.Add(subject);
 }