public CreatePatientViewModel BuildPatientViewModel(Genders gender) { if (gender == null) { throw new ArgumentNullException("gender"); } var model = new CreatePatientViewModel { Genders = GenderItems(gender), DateOfBirthViewModel = _dateOfBirthBuilder.BuildDateOfBirthViewModel(null) }; return(model); }
public void BuildPatientViewModel_GivenGenders_DateOfBirthShouldNotBeNull() { var genders = new Genders() { Items = new List <Gender> { new Gender() } }; var dateOfBirth = new DateOfBirthViewModel(); A.CallTo(() => _dateOfBirthBuilder.BuildDateOfBirthViewModel(A <DateTime?> ._)).Returns(dateOfBirth); var result = _builder.BuildPatientViewModel(genders); A.CallTo(() => _dateOfBirthBuilder.BuildDateOfBirthViewModel(null)).MustHaveHappened(Repeated.Exactly.Once); result.DateOfBirthViewModel.Should().NotBeNull(); }
public void Setup() { Mapper.AddProfile(new AutomapperMappingProfile()); _clinicalSystemIdDescriptionProvider = A.Fake <IClinicalSystemIdDescriptionProvider>(); _userRoleProvider = A.Fake <IUserRoleProvider>(); _dateOfBirthBuilder = A.Fake <IDateOfBirthBuilder>(); A.CallTo(() => _clinicalSystemIdDescriptionProvider.GetDescription()).Returns(Description); A.CallTo(() => _dateOfBirthBuilder.BuildDateOfBirthViewModel(null)).Returns(new DateOfBirthViewModel()); _builder = new PatientViewModelBuilder(_clinicalSystemIdDescriptionProvider, _userRoleProvider, _dateOfBirthBuilder); }