//test insert true public void TestNhaCungCap_Insert() { _nccxl = new NhaCungCapXuLy(); bool actual; try { NhaCungCap ncc = new NhaCungCap(); ncc.MaNhaCc = "NCC10"; ncc.TenNhaCc = "Test"; ncc.DiaChi = "Test"; ncc.DienThoai = "012331456"; ncc.Email = "Test"; _nccxl.NhaCungCap_Insert(ncc); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); NhaCungCap ncc1 = new NhaCungCap(); ncc1.MaNhaCc = "NCC10"; _nccxl.NhaCungCap_Delete(ncc1); }
//test select public void TestNhaCungCap_SelectAll() { _nccxl = new NhaCungCapXuLy(); DataTable dt = _nccxl.NhaCungCap_SelectAll(); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test checkid true public void TestNhaCungCap_CheckId() { _nccxl = new NhaCungCapXuLy(); string item = "NCC1"; bool check = _nccxl.CheckId(item); int actual = 0; if (check) { actual = 1; } Assert.AreEqual(1, actual); }
//test Find true public void TestNhaCungCap_FindItem() { _nccxl = new NhaCungCapXuLy(); string item = "C"; DataTable dt = _nccxl.FindItem(item); int actual = 0; if (dt.Rows.Count != 0) { actual = 1; } Assert.AreEqual(1, actual); }
//test delete public void TestNhaCungCap_Delete() { _nccxl = new NhaCungCapXuLy(); bool actual; try { NhaCungCap ncc = new NhaCungCap(); ncc.MaNhaCc = "NCC10"; _nccxl.NhaCungCap_Delete(ncc); actual = true; } catch (Exception) { actual = false; } Assert.AreEqual(true, actual); }