예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
 protected override void OnLoad()
 {
     ListInitInfo = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
 }
예제 #5
0
 protected override void LoadData()
 {
     grcBase.DataSource = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
     btnTimKiem.Text    = Resources.btnSearch;
 }