//test insert true public void TestPhieuNhap_Insert() { _pnxl = new PhieuNhapXuLy(); bool actual; try { PhieuNhap pn = new PhieuNhap(); pn.MaPhieuNhap = "PN10"; pn.NgayNhap = DateTime.Now; pn.MaNv = "NV1"; pn.MaNhaCc = "NCC1"; _pnxl.PhieuNhap_Insert(pn); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); PhieuNhap pn1 = new PhieuNhap(); pn1.MaPhieuNhap = "PN10"; _pnxl.PhieuNhap_Delete(pn1); }
//test select public void TestPhieuNhap_SelectAll() { _pnxl = new PhieuNhapXuLy(); DataTable dt = _pnxl.PhieuNhap_SelectAll(); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test checkid true public void TestPhieuNhap_CheckId() { _pnxl = new PhieuNhapXuLy(); string item = "PN1"; bool check = _pnxl.CheckId(item); int actual = 0; if (check) { actual = 1; } Assert.AreEqual(1, actual); }
//test Find true public void TestPhieuNhap_FindItem() { _pnxl = new PhieuNhapXuLy(); string item = "N"; DataTable dt = _pnxl.FindItem(item); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test delete public void TestPhieuNhap_Delete() { _pnxl = new PhieuNhapXuLy(); bool actual; try { PhieuNhap pn = new PhieuNhap(); pn.MaPhieuNhap = "PN10"; _pnxl.PhieuNhap_Delete(pn); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); }