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
Beispiel #2
0
        public void SubjectNotExistsInDb()
        {
            var teacher = new TeacherController();

            string SubjectName = "Artttttttt";
            bool   result      = teacher.CheckIfSubjectExists(SubjectName);

            Assert.IsTrue(result, "Subject Artttttt not exists in Database");
        }
Beispiel #3
0
        public void SubjectExistsInDbAndCanSelect()
        {
            var teacher = new TeacherController();

            string SubjectName = "Art";
            bool   result      = teacher.CheckIfSubjectExists(SubjectName);

            Assert.IsFalse(result, "Subject Art exists in Database");
        }