public void Render_DmpNotFound_view_for_post_to_Index_with_project_without_Dmp() { var vm = new CsvDumpViewModel { Projects = Builder <DmpListViewModel> .CreateListOfSize(3).Build() }; _form["DataManagementPlanCsv"] = "Get Data Management Plan to CSV"; _form["ProjectList"] = "5"; _projectRepository.GetByDataManagementPlanId(5).Returns(x => null); var project = SetUpFullProject("GA37493"); project.DataManagementPlan = null; _csvHelper.ExportToCsv(Arg.Any <DataTable>()).Returns(""); _csvHelper.DataManagementPlanToDataTable(Arg.Any <DataManagementPlan>(), Arg.Any <IList <ProjectParty> >()).Returns(new DataTable()); _controller.WithCallTo(c => c.DataManagementPlanToCsv(vm)).ShouldRenderView("DmpNotFound"); _csvHelper.DidNotReceive().ExportToCsv(Arg.Any <DataTable>(), Arg.Any <string>()); _csvHelper.DidNotReceive().DataManagementPlanToDataTable(Arg.Any <DataManagementPlan>(), Arg.Any <IList <ProjectParty> >()); }