/// <summary> /// 添加记录 /// </summary> private void AddLog_Click(object sender, EventArgs e) { try { List <string> errorList = new List <string>();//创建一个错误列表 //获取根据当前页面内容生成的清单(若有错误会被添加到错误列表中) AcceptanceList list = GetAcceptanceList(ref errorList); list.State = "未处理"; //判断是否添加清单成功 if (interviewBll.AddAcceptanceList(list, ref errorList)) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败"); foreach (var i in errorList) { MessageBox.Show(i);//逐条显示错误信息 } } } catch (Exception ex) { MessageBox.Show(ex.Message); } DataBind(); }
public void TestAddAcceptanceList() { Tools.UserCaseHandle userCaseHandle = new Tools.UserCaseHandle(@"C:\Users\96464\Desktop\软件工程\测试用例\Add_AcceptanceList.xls"); IEnumerable acceptanceList = userCaseHandle.GetUserCases(); List <string> errorList = new List <string>(); foreach (var i in acceptanceList) { Assert.AreEqual(false, interviewBll.AddAcceptanceList((AcceptanceList)i, ref errorList)); } AcceptanceList list = new AcceptanceList() { Id = 1, OrderId = 1, AcceptorId = 1, State = "已编目", }; Assert.AreEqual(true, interviewBll.AddAcceptanceList(list, ref errorList)); }
public void TestAddReturnList() { Tools.UserCaseHandle userCaseHandle = new Tools.UserCaseHandle(@"C:\Users\96464\Desktop\软件工程\测试用例\Add_AcceptanceList.xls"); IEnumerable returnList = userCaseHandle.GetUserCases(); List <string> errorList = new List <string>(); foreach (var i in returnList) { Assert.AreEqual(false, interviewBll.AddAcceptanceList((AcceptanceList)i, ref errorList)); } InterviewReturnList list = new InterviewReturnList() { Id = 1, ISBN = "1234567890", OrdererId = 1, BookName = "采访单元测试", Price = 1, PublishingHouseId = 1, DocumentType = "专著", }; Assert.AreEqual(true, interviewBll.AddReturnList(list, ref errorList)); }