public void IndexGET_GivenPatientId_AssessmentListViewModelShouldBeReturned() { var model = new AssessmentListViewModel(); A.CallTo(() => _assessmentBuilder.BuildAssessmentListViewModel(A.Dummy <Guid>(), A <Assessments> ._)).Returns(model); var result = _assessmentController.Index(A.Dummy <Guid>()) as ViewResult; result.Model.Should().BeOfType <AssessmentListViewModel>(); result.Model.Should().Be(model); }
public AssessmentListViewModel BuildAssessmentListViewModel(Guid patientId, Assessments assessments) { if (assessments == null) { throw new ArgumentNullException("assessments"); } if (patientId == Guid.Empty) { throw new ArgumentException("patientId"); } var assessmentViewModels = new List <AssessmentViewModel>(); foreach (var assessment in assessments.Items) { var assessmentViewModel = Mapper.DynamicMap <Assessment, AssessmentViewModel>(assessment); var statusViewModel = Mapper.DynamicMap <Status, StatusViewModel>(assessment.Status); assessmentViewModel.Status = statusViewModel; assessmentViewModel.Stage1DecisionToBeMade = assessmentViewModel.Stage1DecisionToBeMade.Length > 50 ? assessmentViewModel.Stage1DecisionToBeMade.Substring(0, 50) : assessmentViewModel.Stage1DecisionToBeMade; SetCanViewPdfProperty(assessment, assessmentViewModel); SetCanRestartProperty(assessment, assessmentViewModel); SetCanReviseProperty(assessment, assessmentViewModel); assessmentViewModels.Add(assessmentViewModel); } var viewModel = new AssessmentListViewModel { Items = assessmentViewModels, PatientId = patientId, ClinicalIdDescription = _clinicalSystemIdDescriptionProvider.GetDescription() }; return(viewModel); }
public AssessmentListPage(Course course) { InitializeComponent(); BindingContext = _viewModel = new AssessmentListViewModel(course); }