public void AddSubject() { if (teacherController.CheckIfSubjectExists(SubjectName)) { if (teacherController.CheckIfSubjectIsWritten(SubjectName)) { teacherController.SetCurrentSubjectName(SubjectName); } else { MessageBox.Show("Please add a subject name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Subject already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } teacherController.CommitChangedSubject(); MessageBox.Show("Success!", "Operation Completed", MessageBoxButtons.OK); // Clears the subjectNameTxtBox so it can be ready for the next time it's needed subjectNameTxtBox.Clear(); } // R
public void SubjectNotExistsInDb() { var teacher = new TeacherController(); string SubjectName = "Artttttttt"; bool result = teacher.CheckIfSubjectExists(SubjectName); Assert.IsTrue(result, "Subject Artttttt not exists in Database"); }
public void SubjectExistsInDbAndCanSelect() { var teacher = new TeacherController(); string SubjectName = "Art"; bool result = teacher.CheckIfSubjectExists(SubjectName); Assert.IsFalse(result, "Subject Art exists in Database"); }