public void TestThe05_InsertSuccess() { frmDM_The frm = new frmDM_The(); frm.Oid = 0; frm.isAdd = true; frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm); frmChiTietThe.SetInput("Thẻ số 1", "1111", 100, 150, 555000, 55, 2, 3); frmChiTietThe.TestSave(); List <DMLoaiTheKhachHangInfo> list = DmLoaitheKhachHangProvider.Search(new DMLoaiTheKhachHangInfo { TenThe = "Thẻ số 1", MaThe = "1111" }); Assert.AreEqual(list.Count, 1); }
public void TestThe02_MaTheHasExistedOnInsert() { try { frmDM_The frm = new frmDM_The(); frm.Oid = 0; frm.isAdd = true; frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm); frmChiTietThe.SetInput("Thẻ số 1 ", "12345", 100, 150, 555000, 55, 2, 3); frmChiTietThe.TestSave(); Assert.AreEqual("Khong chay dong nay", String.Empty); } catch (Exception ex) { Assert.AreEqual(ex.Message, "Mã thẻ đã tồn tại trong hệ thống !"); } }
public void TestThe01_TenTheIsNotEmpty() { try { frmDM_The frm = new frmDM_The(); frm.Oid = 0; frm.isAdd = true; frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm); frmChiTietThe.SetInput("Thẻ số 1 ", "", 100, 150, 555000, 55, 2, 3); frmChiTietThe.TestSave(); Assert.AreEqual("Khong chay dong nay", String.Empty); } catch (Exception ex) { Assert.AreEqual(ex.Message, "Mã thẻ không được để trống !"); } }
public void TestThe03_MaTheHasExistedOnUpdate() { try { TestThe05_InsertSuccess(); List <DMLoaiTheKhachHangInfo> list = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor(); DMLoaiTheKhachHangInfo infor = list.Find(delegate(DMLoaiTheKhachHangInfo match) { return(match.MaThe == "1111"); }); frmDM_The frm = new frmDM_The(); frm.isAdd = false; frmChiTiet_The frmChiTietThe = new frmChiTiet_The(frm); frmChiTietThe.SetInput("Thẻ số 1 ", "12345", 100, 150, 555000, 55, 2, 3); frmChiTietThe.TestSave(); list = DmLoaitheKhachHangProvider.GetListDmLoaiTheInfor(); List <DMLoaiTheKhachHangInfo> listDuplicate = list.FindAll(delegate(DMLoaiTheKhachHangInfo match) { return(match.MaThe == "12345"); }); frmChiTietThe.TestDelete(); Assert.AreEqual(1, listDuplicate.Count); } catch (Exception ex) { if (ex.GetType() != typeof(AssertFailedException)) { Assert.AreEqual(ex.Message, "Mã thẻ đã tồn tại trong hệ thống !"); } else { throw; } } }