public async void Content_Update_length() { Mock <IReplyRepository> replyRepository = new Mock <IReplyRepository>(); replyRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Reply())); var validator = new ApiReplyServerRequestModelValidator(replyRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiReplyServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Content, new string('A', 141)); }
public async void Content_Create_null() { Mock <IReplyRepository> replyRepository = new Mock <IReplyRepository>(); replyRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Reply())); var validator = new ApiReplyServerRequestModelValidator(replyRepository.Object); await validator.ValidateCreateAsync(new ApiReplyServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Content, null as string); }
public async void ReplierUserId_Create_Invalid_Reference() { Mock <IReplyRepository> replyRepository = new Mock <IReplyRepository>(); replyRepository.Setup(x => x.UserByReplierUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(null)); var validator = new ApiReplyServerRequestModelValidator(replyRepository.Object); await validator.ValidateCreateAsync(new ApiReplyServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.ReplierUserId, 1); }