public void TestForCorrectCalculateAllSetMarks() { var register = new StudentFormController(); string egnPass = "******"; register.InitializeStudent(egnPass); string selectedSubjectName = "Health and hygiene"; register.InitializeSubject(selectedSubjectName); register.StudentMarksToInsert(); var action = "3,32"; string result = register.AvarageMark(); Assert.AreEqual(action, result, "Correct calculated all marks "); }
private void studentSubjectsComboBox_SelectedValueChanged(object sender, EventArgs e) { // Clears all the subjects from selected marks list box and gets the selected subject name SelectedMarksListBox.Items.Clear(); string selectedSubjectName = StudentSubjectsComboBox.SelectedItem.ToString(); // Load controller and make sure we are using the correct student and subject StudentFormController sfc = new StudentFormController(); sfc.InitializeStudent(egnPass); sfc.InitializeSubject(selectedSubjectName); // Inserts Studentmarks into the selectedMarksListBox List <string> StudentMarksToInsert = sfc.StudentMarksToInsert(); StudentMarksToInsert.ForEach(w => SelectedMarksListBox.Items.Add(w)); // Sets average mark with the avarage mark of all marks from the selected subject AvarageMark = "Average: " + sfc.AvarageMark(); averageMark.Visible = true; }