public async void Text_Update_length() { Mock <ICommentRepository> commentRepository = new Mock <ICommentRepository>(); commentRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Comment())); var validator = new ApiCommentRequestModelValidator(commentRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCommentRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Text, new string('A', 701)); }
public async void Text_Create_null() { Mock <ICommentRepository> commentRepository = new Mock <ICommentRepository>(); commentRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Comment())); var validator = new ApiCommentRequestModelValidator(commentRepository.Object); await validator.ValidateCreateAsync(new ApiCommentRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Text, null as string); }