Beispiel #1
0
 public void TestKhachHang06_DeleteFailure()
 {
     try
     {
         frmDM_KhachHang frm = new frmDM_KhachHang();
         frm.Oid   = 0;
         frm.isAdd = true;
         frmChiTiet_KhachHang frmChiTietKhachHang = new frmChiTiet_KhachHang(frm);
         frmChiTietKhachHang.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!");
     }
 }
Beispiel #2
0
        public void TestKhachHang07_DeleteSuccess()
        {
            TestKhachHang05_InsertSuccess();
            List <DMDoiTuongInfo> list  = DmDoiTuongProvider.GetListDmDoiTuongInfo();
            DMDoiTuongInfo        infor = list.Find(delegate(DMDoiTuongInfo match)
            {
                return(match.MaDoiTuong == "11021986");
            });

            frmDM_KhachHang frm = new frmDM_KhachHang();

            frm.isAdd = false;
            frm.Oid   = infor.IdDoiTuong;
            frmChiTiet_KhachHang frmChiTietKhachHang = new frmChiTiet_KhachHang(frm);

            frmChiTietKhachHang.TestDelete();
            list  = DmDoiTuongProvider.GetListDmDoiTuongInfo();
            infor = list.Find(delegate(DMDoiTuongInfo match)
            {
                return(match.MaDoiTuong == "11021986");
            });
            Assert.AreEqual(infor, null);
        }
Beispiel #3
0
        public void TestKhachHang03_MaKhachHangHasExistedOnUpdate()
        {
            try
            {
                TestKhachHang05_InsertSuccess();
                List <DMDoiTuongInfo> list  = DmDoiTuongProvider.GetListDmDoiTuongInfo();
                DMDoiTuongInfo        infor = list.Find(delegate(DMDoiTuongInfo match)
                {
                    return(match.MaDoiTuong == "11021986");
                });

                frmDM_KhachHang frm = new frmDM_KhachHang();
                frm.isAdd = false;
                frm.Oid   = infor.IdDoiTuong;
                frmChiTiet_KhachHang frmChiTietKhachHang = new frmChiTiet_KhachHang(frm);
                frmChiTietKhachHang.SetInput("Nguyễn bá hải", "22222222", "11021986", Convert.ToDateTime("11/12/2011"), "lê cường", "123321", "0436987411", "hainb", "112233", "Units Test Khách Hàng", 1);
                frmChiTietKhachHang.TestSave();
                list = DmDoiTuongProvider.GetListDmDoiTuongInfo();
                List <DMDoiTuongInfo> listDuplicate = list.FindAll(delegate(DMDoiTuongInfo match)
                {
                    return(match.MaDoiTuong == "22222222");
                });
                frmChiTietKhachHang.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã khách hàng đã tồn tại trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }