Exemplo n.º 1
0
 public void ShouldReturnStringArrayForOneStudent()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Student[] allClass = { cucu };
     CollectionAssert.AreEqual(new string[] { "Cucu" }, SortStudentsAlpha(allClass));
 }
Exemplo n.º 2
0
 public void ShouldReturnGeneralMeanForOneStudent()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Student[] allClass = { cucu };
     GeneralMean[] expected = { new GeneralMean("Cucu", 7.5m) };
     CollectionAssert.AreEqual(expected, SortStudentsByGeneralMean(allClass));
 }
Exemplo n.º 3
0
 public void ShouldReturnStudentWithASpecificGeneralMean()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Maters mathBubu = new Maters("Mathematics", new int[] { 9, 8 });
     Maters sportBubu = new Maters("Sport", new int[] { 10, 9 });
     Maters[] bubuMatters = { mathBubu, sportBubu };
     Student bubu = new Student { name = "Bubu", mattersAndNotes = bubuMatters };
     Student[] allClass = { cucu, bubu };
     string[] expected = {"Bubu"};
     CollectionAssert.AreEqual(expected, SearchStudentsByGeneralMean(allClass,9m));
 }
Exemplo n.º 4
0
 public void ShouldReturnStudentsWithTenNotes()
 {
     Maters mathZuzu = new Maters("Mathematics", new int[] { 8, 8 });
     Maters sportZuzu = new Maters("Sport", new int[] { 10, 10 });
     Maters[] zuzuMatters = { mathZuzu, sportZuzu };
     Student zuzu = new Student { name = "Zuzu", mattersAndNotes = zuzuMatters };
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Maters mathBubu = new Maters("Mathematics", new int[] { 9, 8 });
     Maters sportBubu = new Maters("Sport", new int[] { 10, 9 });
     Maters[] bubuMatters = { mathBubu, sportBubu };
     Student bubu = new Student { name = "Bubu", mattersAndNotes = bubuMatters };
     Student[] allClass = { cucu, bubu, zuzu };
     StudWithTenNotes[] expected = { new StudWithTenNotes("Bubu",1), new StudWithTenNotes("Zuzu", 2) };
     CollectionAssert.AreEqual(expected, SearchSudentsWithTenNotes(allClass));
 }
Exemplo n.º 5
0
 public void ShouldReturnMeanForOneMatterNotes()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Assert.AreEqual(6.5m, CalculateMeanForMatter(mathCucu));
 }
Exemplo n.º 6
0
 private decimal CalculateMeanForMatter(Maters maters)
 {
     int sum = 0;
     for (int i = 0; i < maters.notes.Length; i++)
     {
     sum += maters.notes[i];
     }
     return (decimal)sum / maters.notes.Length;
 }
Exemplo n.º 7
0
 public void ShouldSortTwoStudentByGeneralMean()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Maters mathBubu = new Maters("Mathematics", new int[] { 9, 8 });
     Maters sportBubu = new Maters("Sport", new int[] { 10, 9 });
     Maters[] bubuMatters = { mathBubu, sportBubu };
     Student bubu = new Student { name = "Bubu", mattersAndNotes = bubuMatters };
     Student[] allClass = { cucu, bubu };
     GeneralMean[] expected = { new GeneralMean("Bubu", 9m), new GeneralMean("Cucu", 7.5m) };
     CollectionAssert.AreEqual(expected, SortStudentsByGeneralMean(allClass));
 }
Exemplo n.º 8
0
 public void ShouldSortTwoStudentAlpha()
 {
     Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportCucu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] cucuMatters = { mathCucu, sportCucu };
     Student cucu = new Student { name = "Cucu", mattersAndNotes = cucuMatters };
     Maters mathBubu = new Maters("Mathematics", new int[] { 6, 7 });
     Maters sportBubu = new Maters("Sport", new int[] { 8, 9 });
     Maters[] bubuMatters = { mathBubu, sportBubu };
     Student bubu = new Student { name = "Bubu", mattersAndNotes = bubuMatters };
     Student[] allClass = { cucu, bubu};
     CollectionAssert.AreEqual(new string[] { "Bubu", "Cucu" }, SortStudentsAlpha(allClass));
 }