public ActionResult Reject(Leave leave) { if (ModelState.IsValid) { var upc = new LeaveProcessComponent(); leave = upc.Reject(leave); } return(GetJsonResult(leave)); }
public void ApplyThenRejectTest() { _leave = CreateLeave("Unit Test: Apply Then Reject"); LeaveProcessComponent upc = new LeaveProcessComponent(); // 1. Apply a new leave. _leave = upc.Apply(_leave); Assert.AreEqual(_leave.Status, LeaveStatuses.Pending, "Failed to apply new leave."); // 2. Reject it. upc.Reject(_leave); _leave = upc.GetLeaveById(_leave.LeaveID); Assert.AreEqual(_leave.Status, LeaveStatuses.Rejected, "Failed to reject leave."); }