示例#1
0
        public void TestLoaiItem07_DeleteSuccess()
        {
            TestLoaiItem05_InsertSuccess();
            List <DMLoaiItemInfor> list  = DMLoaiItemDataProvider.GetListItemInfor();
            DMLoaiItemInfor        infor = list.Find(delegate(DMLoaiItemInfor match)
            {
                return(match.MaLoaiItem == "5");
            });

            frmDM_LoaiItem frm = new frmDM_LoaiItem();

            frm.isAdd = false;
            frm.Oid   = infor.IdLoaiItem;

            frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);

            frmChiTietLoaiItem.TestDelete();
            list  = DMLoaiItemDataProvider.GetListItemInfor();
            infor = list.Find(delegate(DMLoaiItemInfor match)
            {
                return(match.MaLoaiItem == "5");
            });

            Assert.AreEqual(infor, null);
        }
示例#2
0
 public void TestLoaiItem06_DeleteFailure()
 {
     try
     {
         frmDM_LoaiItem frm = new frmDM_LoaiItem();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);
         frmChiTietLoaiItem.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 !");
     }
 }
示例#3
0
        public void TestLoaiItem05_InsertSuccess()
        {
            frmDM_LoaiItem frm = new frmDM_LoaiItem();

            frm.Oid   = 0;
            frm.isAdd = true;
            frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);

            frmChiTietLoaiItem.SetInput("LoaiItem1", "5", "Unit test ma LoaiItem", 1);
            frmChiTietLoaiItem.TestSave();
            List <DMLoaiItemInfor> list = DMLoaiItemDataProvider.Search(new DMLoaiItemInfor {
                MaLoaiItem = "5"
            });

            Assert.AreEqual(list.Count, 1);
        }
示例#4
0
 public void TestLoaiItem02_MaLoaiItemHasExistedOnInsert()
 {
     try
     {
         frmDM_LoaiItem frm = new frmDM_LoaiItem();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);
         frmChiTietLoaiItem.SetInput("LoaiItem1", "01", "Unit test ma LoaiItem", 1);
         frmChiTietLoaiItem.TestSave();
         Assert.AreEqual("Khong chay dong nay", String.Empty);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "Mã loại Item đã có trong hệ thống !");
     }
 }
示例#5
0
 public void TestLoaiItem01_LoaiItemIsNotEmpty()
 {
     try
     {
         frmDM_LoaiItem frm = new frmDM_LoaiItem();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);
         frmChiTietLoaiItem.SetInput("LoaiItem1", "", "Unit test ma LoaiItem", 1);
         frmChiTietLoaiItem.TestSave();
         Assert.AreEqual("Khong chay dong nay", String.Empty);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "Mã loại Item không được để trống !");
     }
 }
示例#6
0
        public void TestLoaiItem03_MaLoaiItemHasExistedOnUpdate()
        {
            try
            {
                TestLoaiItem05_InsertSuccess();
                List <DMLoaiItemInfor> list  = DMLoaiItemDataProvider.GetListItemInfor();
                DMLoaiItemInfor        infor = list.Find(delegate(DMLoaiItemInfor match)
                {
                    return(match.MaLoaiItem == "5");
                });

                frmDM_LoaiItem frm = new frmDM_LoaiItem();
                frm.isAdd = false;
                frm.Oid   = infor.IdLoaiItem;
                frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm);
                frmChiTietLoaiItem.SetInput("LoaiItem1", "1", "Unit test ma LoaiItem", 1);
                frmChiTietLoaiItem.TestSave();
                list = DMLoaiItemDataProvider.GetListItemInfor();
                List <DMLoaiItemInfor> listDuplicate = list.FindAll(delegate(DMLoaiItemInfor match)
                {
                    return(match.MaLoaiItem == "1");
                });
                frmChiTietLoaiItem.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã loại Item đã có trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }