public async void LastName_Update_length()
        {
            Mock <IClientRepository> clientRepository = new Mock <IClientRepository>();

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

            var validator = new ApiClientRequestModelValidator(clientRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiClientRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.LastName, new string('A', 129));
        }
示例#2
0
        public async void FirstName_Create_null()
        {
            Mock <IClientRepository> clientRepository = new Mock <IClientRepository>();

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

            var validator = new ApiClientRequestModelValidator(clientRepository.Object);
            await validator.ValidateCreateAsync(new ApiClientRequestModel());

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