//test insert true public void TestKhachHang_Insert() { _khxl = new KhachHangXuLy(); bool actual; try { KhachHang kh = new KhachHang(); kh.MaKh = "KH9"; kh.TenKh = "Test"; kh.DiaChi = "Test"; kh.DienThoai = "123456789"; kh.Email = "Test"; kh.NgaySinh = DateTime.Now; kh.TinhTrang = "Test"; _khxl.KhachHang_Insert(kh); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); KhachHang kh1 = new KhachHang(); kh1.MaKh = "KH9"; _khxl.KhachHang_Delete(kh1); }
//test select public void TestKhachHang_SelectAll() { _khxl = new KhachHangXuLy(); DataTable dt = _khxl.KhachHang_SelectAll(); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test laythongtinkh public void TestKhachHang_LayTT() { _khxl = new KhachHangXuLy(); string item = "KH1"; DataTable dt = _khxl.LayThongTinKhachHang(item); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test checkid true public void TestKhachHang_CheckId() { _khxl = new KhachHangXuLy(); string item = "KH1"; bool check = _khxl.CheckId(item); int actual = 0; if (check) { actual = 1; } Assert.AreEqual(1, actual); }
//test Find true public void TestKhachHang_FindItem() { _khxl = new KhachHangXuLy(); string item = "KH"; DataTable dt = _khxl.FindItem(item); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test delete public void TestKhachHang_Delete() { _khxl = new KhachHangXuLy(); bool actual; try { KhachHang kh = new KhachHang(); kh.MaKh = "KH9"; _khxl.KhachHang_Delete(kh); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); }