public void CreatePatientViewModelValidator_GivenDuplicateClinicalId_ValidationShouldFail() { const string clinicalSystemId = "PatientId"; A.CallTo(() => _clinicalIdValidator.Unique(clinicalSystemId)).Returns(false); var model = new CreatePatientViewModel() { ClinicalSystemId = clinicalSystemId, DateOfBirthViewModel = DateOfBirthViewModel(), FirstName = "David", LastName = "Miller", GenderId = 1, NhsNumber = 4567899881 }; var result = ValidationResult(model); result.IsValid.Should().BeFalse(); }
public void Setup() { _futureDateValidator = A.Fake <IFutureDateValidator>(); _clinicalIdValidator = A.Fake <IClinicalIdValidator>(); _nhsValidator = A.Fake <INhsValidator>(); _clinicalSystemIdDescriptionProvider = A.Fake <IClinicalSystemIdDescriptionProvider>(); A.CallTo(() => _clinicalIdValidator.Unique(A <string> ._)).Returns(true); A.CallTo(() => _futureDateValidator.Valid(A <DateTime?> ._)).Returns(true); A.CallTo(() => _nhsValidator.Valid(A <decimal?> ._)).Returns(true); A.CallTo(() => _nhsValidator.Unique(A <decimal?> ._)).Returns(true); }
public void EditPatientViewModelValidator_GivenClinicalIdHasNotBeenChanged_ValidationShouldPass() { const string clinicalSystemId = "PatientId"; A.CallTo(() => _clinicalIdValidator.Unique(clinicalSystemId)).Returns(false); var model = new EditPatientViewModel() { ClinicalSystemId = clinicalSystemId, CurrentClinicalSystemId = clinicalSystemId, DateOfBirthViewModel = DateOfBirthViewModel(), FirstName = "David", LastName = "Miller", GenderId = 1, NhsNumber = 4567899881 }; var result = ValidationResult(model); result.IsValid.Should().BeTrue(); }