Beispiel #1
0
        public void Test_Nhap_Lop_Sai()
        {
            searchDG test_search = new searchDG();
            string   cbbox       = "LOP";
            string   txtbox      = "TK0001TK00011";
            string   actual      = test_search.search_1(cbbox, txtbox);

            string expected = "Lớp quá dài";
        }
Beispiel #2
0
        public void Test_Nhap_Gioi_Tinh_SAI()
        {
            searchDG test_search = new searchDG();
            string   cbbox       = "GIOITINH";
            string   txtbox      = "Namm";
            string   actual      = test_search.search_1(cbbox, txtbox);

            string expected = "Giới tính bị sai";
        }
Beispiel #3
0
        public void Test_Nhap_MADG_QUA_DAI()
        {
            searchDG test_search = new searchDG();
            string   cbbox       = "MADG";
            string   txtbox      = "DG0000001";
            string   actual      = test_search.search_1(cbbox, txtbox);

            string expected = "Mã độc giả quá dài";
        }
Beispiel #4
0
        public void Test_Nhap_Sai_Ngay_2()
        {
            searchDG  test_search = new searchDG();
            string    cbbox       = "NGAYSINH";
            string    txtbox      = "32/12/2019";
            CheckDate date        = new CheckDate();

            Assert.IsTrue(date.Check_Date(txtbox) == "Ngày không hợp lệ");
        }
Beispiel #5
0
        public void Test_Nhap_Dung_Thong_Tin_Tim_Kiem_4()
        {
            searchDG test_search = new searchDG();
            string   cbbox       = "LOP";
            string   txtbox      = "Nam";
            string   actual      = test_search.search_1(cbbox, txtbox);

            string expected = "select*from tblDocGia where LOP like '%" + txtbox + "%'";

            Assert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void Test_Nhap_sai_dinh_dang_ngay()
        {
            searchDG test_search = new searchDG();
            string   cbbox       = "NGAYNHAP";
            string   txtbox      = "30/02/2019";//31 ky tu

            CheckDate date      = new CheckDate();
            string    actual1   = date.Check_Date(txtbox);
            string    expected1 = "Ngày không hợp lệ";

            Assert.AreEqual(expected1, actual1);

            string actual2   = test_search.search_1(cbbox, txtbox);
            string expected2 = "select * from tblDocGia";

            Assert.AreEqual(expected2, actual2);
        }
Beispiel #7
0
        public void Test_Nhap_Dung_Thong_Tin_Tim_Kiem_5()
        {
            searchDG  test_search = new searchDG();
            string    cbbox       = "NGAYSINH";
            string    txtbox      = "28/02/2019";
            CheckDate date        = new CheckDate();

            if (date.Check_Date(txtbox) == "Ngày không hợp lệ")
            {
                Assert.Fail();
            }

            string actual = test_search.search_1(cbbox, txtbox);


            string expected = "select*from tblDocGia where " + cbbox + " like '%" + date.Check_Date(txtbox) + "%'";

            Assert.AreEqual(expected, actual);
        }