public string SaveDonThuoc(QLPHONGKHAMEntities db, DonThuocDTO donThuocEntity) { DONTHUOC donThuocDAO = new DONTHUOC(); BUS.Com.Utils.CopyPropertiesFrom(donThuocEntity, donThuocDAO); return(donThuocService.Save(db, donThuocDAO)); }
internal string Delete(QLPHONGKHAMEntities db, string maDonThuoc) { DONTHUOC donThuocDAO = new DONTHUOC(); object[] id = { maDonThuoc }; if (donThuocService.FindById(db, id, out donThuocDAO) == COM.Constant.RES_FAI) { return(COM.Constant.RES_FAI); } return(donThuocService.Delete(db, donThuocDAO)); }
// Test delete public void Delete_TestCase9() { DONTHUOC donThuoc = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = TestCommon.LEN_10, }; DonThuocDAO dao = new DonThuocDAO(); string actual = dao.Save(db, donThuoc); Assert.Equals(null, actual); }
// Test insert without MaDonThuoc or MaHoSo public void Insert_TestCase2() { DONTHUOC donThuoc = new DONTHUOC { NgayLap = TestCommon.LEN_8, GhiChu = TestCommon.LEN_250 }; DonThuocDAO dao = new DonThuocDAO(); string actual = dao.Save(db, donThuoc); string expected = "1111"; Assert.Equals(expected, actual); }
public void Insert_TestCase3() { DONTHUOC donThuoc = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = "123", }; DonThuocDAO dao = new DonThuocDAO(); string actual = dao.Save(db, donThuoc); string expected = "1111"; // Test Assert.Equals(expected, actual); }
public void Insert_TestCase4() { DONTHUOC donThuoc = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = TestCommon.LEN_10, NgayLap = TestCommon.LEN_8 + "1", GhiChu = TestCommon.LEN_250 + "1" }; DonThuocDAO dao = new DonThuocDAO(); string actual = dao.Save(db, donThuoc); string expected = "1111"; Assert.Equals(expected, actual); }
public string GetInformationDonThuocWithId(QLPHONGKHAMEntities db, string MaHoSo, out DonThuocDTO DonThuocEntity) { DonThuocEntity = new DonThuocDTO(); DONTHUOC donThuocDAO = null; if (donThuocService.FindByParameter(db, MaHoSo, out donThuocDAO) == COM.Constant.RES_FAI) { return(COM.Constant.RES_FAI); } if (donThuocDAO == null) { return(COM.Constant.RES_FAI); } BUS.Com.Utils.CopyPropertiesFrom(donThuocDAO, DonThuocEntity); return(COM.Constant.RES_SUC); }
public void Update_TestCase6() { DonThuocDAO dao = new DonThuocDAO(); DONTHUOC donThuoc = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = TestCommon.LEN_10, }; dao.Save(db, donThuoc); DONTHUOC donThuocUpdate = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, }; // Tạo biến lưu thông tin nhân viên update string actual = dao.Save(db, donThuocUpdate); string expected = "1111"; Assert.Equals(expected, actual); }
public void Update_TestCase5() { // Khởi tạo dao DonThuocDAO dao = new DonThuocDAO(); DONTHUOC donThuoc = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = "123", }; dao.Save(db, donThuoc); DONTHUOC donThuocUpdate = new DONTHUOC { MaDonThuoc = TestCommon.LEN_10, MaHoSo = "TEST UPDATE", }; // Tạo biến lưu thông tin nhân viên update string actual = dao.Save(db, donThuocUpdate); // Biến kết quả string expected = "0000"; // Test Assert.Equals(expected, actual); }