public void PopulateTable() { //WE GET ALL OBJECTS AT THE START ONLY INORDER TO REDUCE THE TIME TAKEN //TO RUN THE TESTS if (all_students == null) { all_students = StudentsManager.GetAllStudents(); } foreach (var student in all_students) { StudentsManager.Save(student); } }
private void addStudent_Click(object sender, EventArgs e) { try { String first_name = this.textbox_firstname.Text; String last_name = this.textbox_lastname.Text; String middle_name = this.textbox_middlename.Text; String student_no = this.textbox_studentno.Text; String reg_no = this.textbox_regno.Text; String course = this.textbox_course.Text; String dob = this.combobox_day.Text + "/" + this.combobox_month.Text + "/" + this.combobox_year.Text; String gender = this.combobox_gender.Text; if (String.IsNullOrEmpty(first_name) || String.IsNullOrEmpty(last_name) || String.IsNullOrEmpty(student_no) || String.IsNullOrEmpty(reg_no) || String.IsNullOrEmpty(course) || photos.Count < MIN_PHOTOS_PER_STUDENT) { label_status.Visible = true; label_status.Text = "Please fill in all the fields and pick atleast 5 pictures of the student:" + photos.Count(); return; } Student student = new Student(first_name, middle_name, last_name, student_no, reg_no, course, dob, gender, photos.ToArray()); if (StudentsManager.Save(student)) { MessageBox.Show("Student Added Successfully"); this.Close(); } else { label_status.Visible = true; label_status.Text = "Operation Not Successfully\n Please try again"; } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public void StudentsManagerSaveTest() { bool sucess = StudentsManager.Save(all_students[0]); Assert.IsTrue(sucess); }