public async void TweetTweetId_Create_Valid_Reference() { Mock <IRetweetRepository> retweetRepository = new Mock <IRetweetRepository>(); retweetRepository.Setup(x => x.TweetByTweetTweetId(It.IsAny <int>())).Returns(Task.FromResult <Tweet>(new Tweet())); var validator = new ApiRetweetServerRequestModelValidator(retweetRepository.Object); await validator.ValidateCreateAsync(new ApiRetweetServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.TweetTweetId, 1); }
public async void RetwitterUserId_Create_Invalid_Reference() { Mock <IRetweetRepository> retweetRepository = new Mock <IRetweetRepository>(); retweetRepository.Setup(x => x.UserByRetwitterUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(null)); var validator = new ApiRetweetServerRequestModelValidator(retweetRepository.Object); await validator.ValidateCreateAsync(new ApiRetweetServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.RetwitterUserId, 1); }