public void Redirect_to_edit_for_existing_project_when_new_called_with_invalid_id() { const string userId = "XX12345"; CreateUser(userId); var project = Builder <Project> .CreateNew() .Do(o => o.Parties.Add(Builder <ProjectParty> .CreateNew() .With(q => q.Party = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build()) .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator) .Build())) .Build(); _projectRepository.Get(project.Id).Returns(project); _controller.WithCallTo(c => c.New(project.Id)) .ShouldRedirectTo(_controller.GetType().GetMethod("Edit", new[] { typeof(int), typeof(int) })); }
public void Redirect_to_new_action_of_dmp_controller_with_get_call_to_copy_and_dmp_status_is_in_progress() { const string userId = "XX12345"; CreateUser(userId); var project = Builder <Project> .CreateNew() .With(o => o.DataManagementPlan = Builder <DataManagementPlan> .CreateNew().Build()) .And(o => o.ProvisioningStatus = ProvisioningStatus.Pending) .Do(o => o.Parties.Add(Builder <ProjectParty> .CreateNew() .With(q => q.Party = Builder <Party> .CreateNew().With(r => r.UserId = userId).Build()) .And(q => q.Relationship = ProjectRelationship.PrincipalInvestigator) .Build())) .Build(); _projectRepository.Get(project.Id).Returns(project); _controller.WithCallTo(c => c.CopyDmp(project.Id)) .ShouldRedirectTo <DmpController>(_dmpController.GetType().GetMethod("New", new[] { typeof(int) })); }