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); }
public async void UserId_Create_Valid_Reference() { Mock <ICommentRepository> commentRepository = new Mock <ICommentRepository>(); commentRepository.Setup(x => x.UserByUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User())); var validator = new ApiCommentServerRequestModelValidator(commentRepository.Object); await validator.ValidateCreateAsync(new ApiCommentServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.UserId, 1); }