public void AddInterviewCatalogTest()
        {
            //Tools.UserCaseHandle userCaseHandle = new Tools.UserCaseHandle(@"E:\大三课程文档汇总\软件工程\FunctionTest\Add_CatalogFormList.xls");
            //IEnumerable interviewCatalog = userCaseHandle.GetUserCases();
            List <string>    errorList  = new List <string>();
            InterviewCatalog interview1 = new InterviewCatalog()
            {
                Id          = 1,
                InterviewId = 1,
                State       = "",
            };

            Assert.AreEqual(false, createCatalogBll.AddInterviewCatalog(interview1, ref errorList));

            int maxId = -1;

            foreach (AcceptanceList i in interviewBll.GetAllAcceptanceListArray())
            {
                if (i.Id > maxId)
                {
                    maxId = i.Id;
                }
            }
            InterviewCatalog list = new InterviewCatalog()
            {
                Id          = 1,
                InterviewId = maxId,
                State       = "可编目",
            };

            Assert.AreEqual(true, createCatalogBll.AddInterviewCatalog(list, ref errorList));
        }
示例#2
0
 /// <summary>
 /// 编目按钮点击
 /// </summary>
 private void catalogBtn_Click(object sender, EventArgs e)
 {
     try
     {
         List <string> errorList = new List <string>();//创建一个错误列表
         //获取根据当前页面内容生成的订单(若有错误会被添加到错误列表中)
         InterviewCatalog list = GetAllCatalogList(ref errorList);
         //判断是否添加订单成功
         if (createCatalogBll.AddInterviewCatalog(list, ref errorList))
         {
             MessageBox.Show("添加成功");
         }
         else
         {
             MessageBox.Show("添加失败");
             foreach (var i in errorList)
             {
                 MessageBox.Show(i);//逐条显示错误信息
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataBind();//数据绑定
 }