public void TestListDM03_MaListDMHasExistedOnUpdate()
        {
            try
            {
                TestListDM05_InsertSuccess();
                List <DMListInfor> list  = KhaiBaoDMDataProvider.GetListKhaiBaoInfo();
                DMListInfor        infor = list.Find(delegate(DMListInfor match)
                {
                    return(match.TblName == "tbl_dm_1");
                });

                frmDM_ListDM frm = new frmDM_ListDM();
                frm.isAdd   = true;
                frm.TblName = infor.TblName;
                frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);
                frmChiTietListDM.SetInput("Danh mục 1", "fgh", 1);
                frmChiTietListDM.TestSave();
                Assert.AreEqual("Khong chay dong nay", String.Empty);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Tên bảng đã tồn tại trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }
 public void TestListDM06_DeleteFailure()
 {
     try
     {
         frmDM_ListDM frm = new frmDM_ListDM();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);
         frmChiTietListDM.TestDelete();
         Assert.AreEqual("Khong chay dong nay", String.Empty);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "Bạn không thể xóa khi đang thêm mới !");
     }
 }
        public void TestListDM05_InsertSuccess()
        {
            frmDM_ListDM frm = new frmDM_ListDM();

            frm.Oid   = 0;
            frm.isAdd = true;
            frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);

            frmChiTietListDM.SetInput("Danh mục 1", "tbl_dm_1", 1);
            frmChiTietListDM.TestSave();
            List <DMListInfor> list = KhaiBaoDMDataProvider.Search(new DMListInfor {
                TblName = "tbl_dm_1", Name = "Danh mục 1"
            });

            Assert.AreEqual(list.Count, 1);
        }
 public void TestListDM02_TblNameHasExistedOnInsert()
 {
     try
     {
         frmDM_ListDM frm = new frmDM_ListDM();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);
         frmChiTietListDM.SetInput("Danh mục 1", "fgh", 1);
         frmChiTietListDM.TestSave();
         Assert.AreEqual("Khong chay dong nay", String.Empty);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "Tên bảng đã tồn tại trong hệ thống !");
     }
 }
 public void TestListDM01_TblNameIsNotEmpty()
 {
     try
     {
         frmDM_ListDM frm = new frmDM_ListDM();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);
         frmChiTietListDM.SetInput("Danh mục 1", "", 1);
         frmChiTietListDM.TestSave();
         Assert.AreEqual("Khong chay dong nay", String.Empty);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "Tên bảng không được để trống !");
     }
 }
        public void TestListDM07_DeleteSuccess()
        {
            TestListDM05_InsertSuccess();
            List <DMListInfor> list  = KhaiBaoDMDataProvider.GetListKhaiBaoInfo();
            DMListInfor        infor = list.Find(delegate(DMListInfor match)
            {
                return(match.TblName == "tbl_dm_1");
            });

            frmDM_ListDM frm = new frmDM_ListDM();

            frm.isAdd   = false;
            frm.TblName = infor.TblName;
            frmChiTiet_ListDM frmChiTietListDM = new frmChiTiet_ListDM(frm);

            frmChiTietListDM.TestDelete();
            list  = KhaiBaoDMDataProvider.GetListKhaiBaoInfo();
            infor = list.Find(delegate(DMListInfor match)
            {
                return(match.TblName == "tbl_dm_1");
            });

            Assert.AreEqual(infor, null);
        }