Пример #1
0
        public void RejectRequisition_Valid()
        {
            // Arrange
            requisitionService.Save(new Requisition()
            {
                RequisitionId      = "APPROVETEST",
                Status             = statusService.FindStatusByStatusId(4),
                CreatedDateTime    = DateTime.Now,
                RequisitionDetails = new List <RequisitionDetail>()
                {
                    new RequisitionDetail()
                    {
                        RequisitionId = "APPROVETEST",
                        ItemCode      = "E030",
                        Status        = statusService.FindStatusByStatusId(4),
                    }
                }
            });
            var expected = statusService.FindStatusByStatusId(5);

            // Act
            requisitionService.RejectRequisition("APPROVETEST", "*****@*****.**", "I REJECT THIS");

            // Assert
            Assert.AreEqual(expected.StatusId, requisitionRepository.FindById("APPROVETEST").Status.StatusId);
        }
        // POST: /Requisition/Reject
        public ActionResult Reject(string rid, string email, string remarks)
        {
            var checkEmail = email;

            if (checkEmail == "")
            {
                checkEmail = System.Web.HttpContext.Current.User.Identity.GetUserName();
            }

            requisitionService.RejectRequisition(rid, checkEmail, remarks);
            TempData["reject"] = String.Format("Requisition #{0} rejected.", rid);
            return(RedirectToAction("ManageRequisitions", "Requisition"));
        }