Exemplo n.º 1
0
        public void ChangePasswordTest()
        {
            CUser u = new CTeachingStaff("test", "test", "123456", "Software", "TS", "Lecturer", null);

            Program.update_sql("insert into login values('" + u.Id + "','" + u.Name + "','" + u.Password + "','" + u.Permission + "','" + u.Department + "','NULL')");
            u.ChangePassword("123456");
            DataTable dt = Program.get_dt("SELECT password from Login WHERE Id='" + u.Id + "'");

            Assert.IsTrue(dt.Rows[0][0].ToString() == u.Password);
            Program.update_sql("DELETE login WHERE id='TEST'");
        }
Exemplo n.º 2
0
        public void addConstraintsToDBTest()
        {
            CTeachingStaff t = new CTeachingStaff("test", "test", "test", "test", "test", "Lecturer", "abcd");

            Program.update_sql("insert into login values('" + t.Id + "','" + t.Name + "','" + t.Password + "','" + t.Permission + "','" + t.Department + "','NULL')");
            Program.update_sql("insert into teaching_staff values('" + t.Id + "','" + t.Type + "','test')");
            t.addConstraintsToDB();
            DataTable dt = Program.get_dt("SELECT constraints from Teaching_staff WHERE Id='" + t.Id + "'");

            Assert.IsTrue(dt.Rows[0][0].ToString() == t.Constraints);
            Program.update_sql("DELETE TEACHING_STAFF WHERE id='test'");
            Program.update_sql("DELETE login WHERE id='test'");
        }
Exemplo n.º 3
0
        public void DismissTeachingStaffTest()
        {
            CHeadOfDepartment hod = new CHeadOfDepartment("test", "test", "test", "test", "test");
            CTeachingStaff    ts  = new CTeachingStaff("test", "test", "test", "test", "test", "Lecturer", null);

            Program.update_sql("insert into login values('" + ts.Id + "','" + ts.Name + "','" + ts.Password + "','" + ts.Permission + "','" + ts.Department + "')");
            Program.update_sql("insert into teaching_staff values('" + ts.Id + "','" + ts.Type + "','" + ts.Constraints + "')");
            hod.DismissTeachingStaff(ts.Id);
            DataTable dt  = Program.get_dt("SELECT * from teaching_staff WHERE Id='test'");
            DataTable dt2 = Program.get_dt("SELECT * from login WHERE Id='test'");

            Assert.IsTrue(dt.Rows.Count == 0 && dt2.Rows.Count == 0);
        }