public void Render_default_view_for_get_to_Index() { var projects = Builder <Project> .CreateListOfSize(5) .All() .With(p => p.DataManagementPlan = Builder <DataManagementPlan> .CreateNew().Build()) .Build(); _projectRepository.GetAll().Returns(projects); var dataCollections = Builder <DataCollection> .CreateListOfSize(5) .All() .Build(); _dataCollectionRepository.GetAll().Returns(dataCollections); _controller.WithCallTo(c => c.Index()).ShouldRenderDefaultView(); }
public ActionResult Index() { var projects = _projectRepository.GetAll(); var projectModels = projects.Where(p => p.DataManagementPlan != null).Select(p => new DmpListViewModel { Id = p.DataManagementPlan.Id, Title = p.Title }).ToList(); var dataCollections = _dataCollectionRepository.GetAll(); var dataCollectionModels = dataCollections.Select(d => new CollectionListViewModel { Id = d.Id, Title = d.Title }).ToList(); var model = new CsvDumpViewModel { Projects = projectModels, DataCollections = dataCollectionModels }; return(View(model)); }