Ejemplo n.º 1
0
        public void ApproveRequisition_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(6);

            // Act
            requisitionService.ApproveRequisition("APPROVETEST", "*****@*****.**", "I APPROVE THIS");

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

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

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