public ActionResult Delete(int id, FormCollection collection) { var projectUser = ProjectUserRepository.ProjectUserFetch(id); ProjectUserRepository.ProjectUserDelete(id); return(this.RedirectToAction("Details", "Project", new { id = projectUser.ProjectId })); }
public void ProjectUser_Fetch() { var projectUserMember = ProjectUserTestHelper.ProjectUserNew(); projectUserMember = ProjectUserRepository.ProjectUserSave(projectUserMember); projectUserMember = ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); Assert.IsTrue(projectUserMember != null, "Row returned should not equal null"); }
public void ProjectUser_Add() { var projectUserMember = ProjectUserTestHelper.ProjectUserNew(); Assert.IsTrue(projectUserMember.IsValid, "IsValid should be true"); projectUserMember = ProjectUserRepository.ProjectUserSave(projectUserMember); Assert.IsTrue(projectUserMember.ProjectUserMemberId != 0, "ProjectUserMemberId should be a non-zero value"); ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); }
public ActionResult Delete(int id) { var model = new DeleteModel(); var projectUser = ProjectUserRepository.ProjectUserFetch(id); model.Title = "Project User Delete"; model.Id = projectUser.ProjectUserMemberId; model.Name = "Project User"; model.Description = projectUser.UserName; model.ControllerName = "ProjectUser"; model.BackUrl = Url.Action("Details", "Project", new { id = projectUser.ProjectId }); return(this.View(model)); }
public void ProjectUser_Edit() { var projectUserMember = ProjectUserTestHelper.ProjectUserNew(); var roleId = projectUserMember.RoleId; Assert.IsTrue(projectUserMember.IsValid, "IsValid should be true"); projectUserMember = ProjectUserRepository.ProjectUserSave(projectUserMember); projectUserMember = ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); projectUserMember.RoleId = (int)Role.Reviewer; projectUserMember = ProjectUserRepository.ProjectUserSave(projectUserMember); projectUserMember = ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); Assert.IsTrue(projectUserMember.RoleId != roleId, "RoleId should have different value"); }
public void ProjectUser_Delete() { var projectUserMember = ProjectUserTestHelper.ProjectUserNew(); Assert.IsTrue(projectUserMember.IsValid, "IsValid should be true"); projectUserMember = ProjectUserRepository.ProjectUserSave(projectUserMember); projectUserMember = ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); ProjectUserRepository.ProjectUserDelete(projectUserMember.ProjectUserMemberId); try { ProjectUserRepository.ProjectUserFetch(projectUserMember.ProjectUserMemberId); } catch (Exception ex) { Assert.IsTrue(ex.GetBaseException() is InvalidOperationException); } }