コード例 #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 ApiVPersonServerRequestModelValidator(vPersonRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiVPersonServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.PersonName, new string('A', 51));
        }
コード例 #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 ApiVPersonServerRequestModelValidator(vPersonRepository.Object);
            await validator.ValidateCreateAsync(new ApiVPersonServerRequestModel());

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