public void Search_TestCase1() { // create data search db.BENHNHANs.Add(new BENHNHAN { MaBenhNhan = "1234567890", HoTen = "aaaaaaaaaa" }); db.BENHNHANs.Add(new BENHNHAN { MaBenhNhan = "1234567891", HoTen = "bbbbbbbbbb" }); db.BENHNHANs.Add(new BENHNHAN { MaBenhNhan = "1234567892", HoTen = "cccccccccc" }); // create object search BenhNhanSearchEntity benhNhanSearch = new BenhNhanSearchEntity { MaBenhNhan = "12345678", TenBenhNhan = "", CMND = "" }; List <BenhNhanDTO> listResult = null; BenhNhanBUS benhNhanBUS = new BenhNhanBUS(); // execute string actual = benhNhanBUS.SearchBenhNhan(db, benhNhanSearch, out listResult); string expected = "0000"; // compare Assert.Equals(actual, expected); }
public string SearchBenhNhan(BenhNhanDTO BenhNhan, out List <BenhNhanDTO> ListBenhNhan, int IdScreen) { // nếu đối tượng search == null if (BenhNhan == null) { // tạo mới đối tượng BenhNhan = new BenhNhanDTO(); } // Tạo dối tượng BenhNhanBUS BenhNhanBUS benhNhanBus = new BenhNhanBUS(); // Tạo Search key object BenhNhanSearchEntity benhNhanSearchEntity = new BenhNhanSearchEntity { MaBenhNhan = BenhNhan.MaBenhNhan, TenBenhNhan = BenhNhan.HoTen, CMND = BenhNhan.CMND }; using (QLPHONGKHAMEntities db = new QLPHONGKHAMEntities()) { benhNhanBus.SearchBenhNhan(db, benhNhanSearchEntity, out ListBenhNhan); } // nếu kết quả trả về là list rỗng if (ListBenhNhan.Count == 0) { return(Constant.RES_FAI); } return(Constant.RES_SUC); }
public void Search_TestCase2() { // create object search BenhNhanSearchEntity benhNhanSearch = new BenhNhanSearchEntity { MaBenhNhan = "12345678", TenBenhNhan = "", CMND = "" }; BenhNhanBUS benhNhanBUS = new BenhNhanBUS(); List <BenhNhanDTO> listResult = null; string actual = benhNhanBUS.SearchBenhNhan(db, benhNhanSearch, out listResult); string expected = "0000"; Assert.Equals(actual, expected); }