public void TestDuAn07_DeleteSuccess() { TestLoaiSP05_InsertSuccess(); List <DMLoaiSanPhamInfo> list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); DMLoaiSanPhamInfo infor = list.Find(delegate(DMLoaiSanPhamInfo match) { return(match.MaLoaiSP == "13"); }); frmDM_LoaiSanPham frm = new frmDM_LoaiSanPham(); frm.isAdd = false; frm.Oid = infor.IdLoaiSP; frmChiTiet_LoaiSanPham frmChiTiet = new frmChiTiet_LoaiSanPham(frm); frmChiTiet.TestDelete(); list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); infor = list.Find(delegate(DMLoaiSanPhamInfo match) { return(match.MaLoaiSP == "13"); }); Assert.AreEqual(infor, null); }
public frmDmLoaiSanPhamTestUnits() { frmLogin frmLogin = new frmLogin(); frmLogin.TestLogin("quantri", "quantri"); //chuẩn bị dữ liệu để test List <DMLoaiSanPhamInfo> list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); List <DMLoaiSanPhamInfo> listMatch = list.FindAll(delegate(DMLoaiSanPhamInfo match) { return(match.MaLoaiSP == "13"); }); foreach (var dmLoaiSanPhamInfo in listMatch) { DMLoaiSanPhamDataProvider.Instance.Delete(dmLoaiSanPhamInfo); } }
public void TestCauHinh03_MaCauHinhHasExistedOnUpdate() { try { TestLoaiSP05_InsertSuccess(); List <DMLoaiSanPhamInfo> list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); DMLoaiSanPhamInfo infor = list.Find(delegate(DMLoaiSanPhamInfo match) { return(match.MaLoaiSP == "13"); }); frmDM_LoaiSanPham frm = new frmDM_LoaiSanPham(); frm.isAdd = false; frm.Oid = infor.IdLoaiSP; frmChiTiet_LoaiSanPham frmChiTiet = new frmChiTiet_LoaiSanPham(frm); frmChiTiet.SetInput("Test1", "03", "Unit test ma du an", 1, 1); frmChiTiet.TestSave(); list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); List <DMLoaiSanPhamInfo> listDuplicate = list.FindAll(delegate(DMLoaiSanPhamInfo match) { return(match.MaLoaiSP == "03"); }); frmChiTiet.TestDelete(); Assert.AreEqual(1, listDuplicate.Count); } catch (Exception ex) { if (ex.GetType() != typeof(AssertFailedException)) { Assert.AreEqual(ex.Message, "Mã đã tồn tại trong hệ thống!"); } else { throw; } } }
protected override void OnLoad() { ListInitInfo = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); }
protected override void LoadData() { grcBase.DataSource = DMLoaiSanPhamDataProvider.GetLoaiSPInfor(); btnTimKiem.Text = Resources.btnSearch; }