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)); }
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)); }
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)); }
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)); }
public void ShouldReturnMeanForOneMatterNotes() { Maters mathCucu = new Maters("Mathematics", new int[] { 6, 7 }); Assert.AreEqual(6.5m, CalculateMeanForMatter(mathCucu)); }
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; }
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)); }
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)); }