Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void TestNumberOfSubjectsByPupilAfterSort()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     catalog.SortNames();
     Assert.AreEqual(true, catalog.CheckPupilSubjectsCount(1, 3));//"John Smith" => 3
 }
Exemplo n.º 3
0
 public void TestNumberOfNotesBySubjectAfterSort()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     catalog.SortNames();
     Assert.AreEqual(true, catalog.CheckPupilSubjectNotesCount(1, "Mathematics", 4));//"John Smith" => 4
     Assert.AreEqual(true, catalog.CheckPupilSubjectNotesCount(1, "Literature", 3));//"John Smith" => 3
 }
Exemplo n.º 4
0
 public void TestCatalogNoRecords()
 {
     Catalog catalog = new Catalog();
     Assert.AreEqual(false, catalog.HasRecords());
     Assert.AreNotEqual(true, catalog.HasRecords());
 }
Exemplo n.º 5
0
 public void TestCatalogAddData()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     Assert.AreEqual(true, catalog.HasRecords());
 }
Exemplo n.º 6
0
 public void TestSortForPupilsWithSortSystem()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     Assert.AreEqual(true, catalog.CheckPupilName(0, "John Smith"));
     catalog.SortNames();
     Assert.AreEqual(true, catalog.CheckPupilName(0, "Edward Hall"));
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public void TestPupilsOrderAfterSortDescByAverage()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     catalog.SortNames();
     catalog.SortDescendentGeneralAverage();
     Assert.AreEqual(true, catalog.CheckPupilName(0, "John Smith"));
     Assert.AreEqual(true, catalog.CheckPupilName(3, "Sarah Parker"));
     Assert.AreEqual(true, catalog.CheckPupilName(4, "Tom Miller"));
 }
Exemplo n.º 9
0
 public void TestOrderByForPupilsWithOrderBySystem()
 {
     Catalog catalog = new Catalog();
     AddRecords(catalog);
     Assert.AreEqual(true, catalog.CheckPupilName(0, "John Smith"));
     catalog.OrderByName();
     Assert.AreEqual(true, catalog.CheckPupilName(0, "Edward Hall"));
 }