Beispiel #1
0
        public async void PhoneNumber_Update_length()
        {
            Mock <IPersonPhoneRepository> personPhoneRepository = new Mock <IPersonPhoneRepository>();

            personPhoneRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PersonPhone()));

            var validator = new ApiPersonPhoneRequestModelValidator(personPhoneRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPersonPhoneRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PhoneNumber, new string('A', 26));
        }
Beispiel #2
0
        public async void PhoneNumber_Create_null()
        {
            Mock <IPersonPhoneRepository> personPhoneRepository = new Mock <IPersonPhoneRepository>();

            personPhoneRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PersonPhone()));

            var validator = new ApiPersonPhoneRequestModelValidator(personPhoneRepository.Object);
            await validator.ValidateCreateAsync(new ApiPersonPhoneRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PhoneNumber, null as string);
        }