public async void Text_Update_null() { Mock <ICommentRepository> commentRepository = new Mock <ICommentRepository>(); commentRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Comment())); var validator = new ApiCommentServerRequestModelValidator(commentRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCommentServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Text, null as string); }
public async void PostId_Update_Valid_Reference() { Mock <ICommentRepository> commentRepository = new Mock <ICommentRepository>(); commentRepository.Setup(x => x.PostByPostId(It.IsAny <int>())).Returns(Task.FromResult <Post>(new Post())); var validator = new ApiCommentServerRequestModelValidator(commentRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCommentServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.PostId, 1); }