Example #1
0
        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
Example #2
0
        public void CorrectInputForSubject()
        {
            var teacher     = new TeacherController();
            var SubjectName = "asd";

            var result = teacher.CheckIfSubjectIsWritten(SubjectName);

            Assert.IsTrue(result, "This SubjectName is correct and can add in Database/Subjects");
        }