コード例 #1
0
        public async void FirstName_Update_null()
        {
            Mock <IHandlerRepository> handlerRepository = new Mock <IHandlerRepository>();

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

            var validator = new ApiHandlerServerRequestModelValidator(handlerRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiHandlerServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.FirstName, null as string);
        }
コード例 #2
0
        public async void Email_Update_length()
        {
            Mock <IHandlerRepository> handlerRepository = new Mock <IHandlerRepository>();

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

            var validator = new ApiHandlerServerRequestModelValidator(handlerRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiHandlerServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Email, new string('A', 129));
        }