예제 #1
0
        public void XoaTKTest()
        {
            TAIKHOAN  TK    = new TAIKHOAN();
            DataTable dt    = TK.gettable();
            int       truoc = dt.Rows.Count;
            int       MaTK  = 32;

            TK.XoaTK(MaTK);
            DataTable maTK = TK.getMaTK(MaTK);
            DataTable dt2  = TK.gettable();
            int       sau  = dt2.Rows.Count;

            Assert.AreEqual(truoc, (sau + 1));
            Assert.AreEqual(maTK.Rows.Count, 0);
        }
예제 #2
0
        public void SuaTKTest()
        {
            TAIKHOAN  TK       = new TAIKHOAN();
            DataTable dt       = TK.gettable();
            int       MaTK     = 32;
            string    Email    = "*****@*****.**";
            string    Matkhau  = "1234567";
            string    Hoten    = "Nguyễn Anh Tuấn 2";
            string    Diachi   = "Bắc Giang";
            string    TenQ     = "Admin";
            bool      Gioitinh = true;
            DateTime  Ngaysinh = DateTime.Parse("01/01/1996");

            TK.SuaTK(MaTK, Email, Matkhau, Hoten, Ngaysinh, Diachi, Gioitinh, TenQ);
            DataTable dt2 = TK.getMaTK(MaTK);

            Assert.AreEqual(dt2.Rows[0].ItemArray[5].ToString().Trim(), Hoten);
            Assert.AreEqual(dt2.Rows[0].ItemArray[7].ToString().Trim(), Diachi);
            Assert.AreEqual(dt2.Rows[0].ItemArray[6].ToString().Trim(), Ngaysinh.ToString());
            Assert.AreEqual(dt2.Rows[0].ItemArray[2].ToString().Trim(), TenQ);
            Assert.AreEqual(dt2.Rows[0].ItemArray[8], Gioitinh);
        }