Ejemplo n.º 1
0
 /// <summary>
 /// 添加记录
 /// </summary>
 private void AddButton_Click(object sender, EventArgs e)
 {
     try
     {
         List <string> errorList = new List <string>();//创建一个错误列表
         //获取根据当前页面内容生成的清单(若有错误会被添加到错误列表中)
         InterviewReturnList list = GetReturnList(ref errorList);
         //判断是否添加清单成功
         if (interviewBll.AddReturnList(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 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));
        }