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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }