public IActionResult DeleteProject(Int64 id) { try { _apiObject.Delete(id); return(RedirectToAction(LANDING_PAGE_ACTION_NAME)); } catch (Exception ex) { return(GetErrorResponse("DeleteProject", ex.Message)); } }
public void Delete_Should_Delete_A_Project() { _repository .Setup(it => it.Delete(It.IsAny <Int32>())) .Callback <Int32>((projectId) => { var i = _repositoryList.FindIndex(q => q.ProjectId == projectId); _repositoryList.RemoveAt(i); }); var iniCount = _repositoryList.Count(); HttpResponseMessage result = _target.Delete(1); Assert.AreEqual(iniCount - 1, _repositoryList.Count()); Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); }