Example #1
0
        public void WhenClickOnCreateButton()
        {
            A.CallTo(() => _futureDateValidator.Valid(A <DateTime> ._)).Returns(true);
            var validator = new AssessmentViewModelValidator(_futureDateValidator);

            _validatorResult = validator.Validate(_assessmentModel);
        }
Example #2
0
        public void Setup()
        {
            _futureDateValidator = A.Fake <IFutureDateValidator>();

            A.CallTo(() => _futureDateValidator.Valid(A <DateTime?> ._)).Returns(true);

            _dateOfBirthViewModelValidator = new DateOfBirthViewModelValidator(_futureDateValidator);
        }
        public void Setup()
        {
            _futureDateValidator = A.Fake <IFutureDateValidator>();
            _nhsValidator        = A.Fake <INhsValidator>();
            _clinicalSystemIdDescriptionProvider = A.Fake <IClinicalSystemIdDescriptionProvider>();

            A.CallTo(() => _clinicalSystemIdDescriptionProvider.GetDescription()).Returns(Clinicalsystemid);
            A.CallTo(() => _futureDateValidator.Valid(A <DateTime?> ._)).Returns(true);
            A.CallTo(() => _nhsValidator.Valid(A <decimal?> ._)).Returns(true);
        }
Example #4
0
        public void Valid_GivenDateOfBirthIsInTheFuture_ValidationShouldFail()
        {
            A.CallTo(() => _futureDateValidator.Valid(A <DateTime?> ._)).Returns(false);

            var model = new DateOfBirthViewModel()
            {
                Day   = 1,
                Month = 1,
                Year  = 2050
            };

            var result = ValidationResult(model);

            result.IsValid.Should().BeFalse();
        }
Example #5
0
        public void AssessmentViewModelValidator_AssessmentDateIsInTheFuture_ValidationShouldFail()
        {
            _futureDateValidator = A.Fake <IFutureDateValidator>();
            A.CallTo(() => _futureDateValidator.Valid(A <DateTime> ._)).Returns(false);

            var model = new AssessmentViewModel()
            {
                DateAssessmentStarted     = DateTime.Now.AddDays(1),
                Stage1DecisionToBeMade    = "decision",
                Stage1DecisionClearlyMade = true
            };

            var validator = new AssessmentViewModelValidator(_futureDateValidator);
            var result    = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Example #6
0
        public void EditPatientViewModelValidator_GivenDateOfBirthDateIsInTheFuture_ValidationShouldFail()
        {
            A.CallTo(() => _futureDateValidator.Valid(A <DateTime?> ._)).Returns(false);

            var model = new EditPatientViewModel()
            {
                ClinicalSystemId     = "PatientId",
                FirstName            = "David",
                LastName             = "Miller",
                GenderId             = 1,
                NhsNumber            = 4567899881,
                DateOfBirthViewModel = new DateOfBirthViewModel()
                {
                    Year  = 2050,
                    Month = 1,
                    Day   = 1
                }
            };

            var result = ValidationResult(model);

            result.IsValid.Should().BeFalse();
        }
Example #7
0
 public void Setup()
 {
     _futureDateValidator = A.Fake <IFutureDateValidator>();
     A.CallTo(() => _futureDateValidator.Valid(A <DateTime> ._)).Returns(true);
 }