Ejemplo n.º 1
0
        public async void PersonName_Update_length()
        {
            Mock <IVPersonRepository> vPersonRepository = new Mock <IVPersonRepository>();

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

            var validator = new ApiVPersonRequestModelValidator(vPersonRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiVPersonRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PersonName, new string('A', 51));
        }
Ejemplo n.º 2
0
        public async void PersonName_Create_null()
        {
            Mock <IVPersonRepository> vPersonRepository = new Mock <IVPersonRepository>();

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

            var validator = new ApiVPersonRequestModelValidator(vPersonRepository.Object);
            await validator.ValidateCreateAsync(new ApiVPersonRequestModel());

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