public async void SourceTweetId_Update_Valid_Reference() { Mock <IQuoteTweetRepository> quoteTweetRepository = new Mock <IQuoteTweetRepository>(); quoteTweetRepository.Setup(x => x.TweetBySourceTweetId(It.IsAny <int>())).Returns(Task.FromResult <Tweet>(new Tweet())); var validator = new ApiQuoteTweetServerRequestModelValidator(quoteTweetRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiQuoteTweetServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.SourceTweetId, 1); }
public async void Content_Update_length() { Mock <IQuoteTweetRepository> quoteTweetRepository = new Mock <IQuoteTweetRepository>(); quoteTweetRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new QuoteTweet())); var validator = new ApiQuoteTweetServerRequestModelValidator(quoteTweetRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiQuoteTweetServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Content, new string('A', 141)); }
public async void RetweeterUserId_Update_Invalid_Reference() { Mock <IQuoteTweetRepository> quoteTweetRepository = new Mock <IQuoteTweetRepository>(); quoteTweetRepository.Setup(x => x.UserByRetweeterUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(null)); var validator = new ApiQuoteTweetServerRequestModelValidator(quoteTweetRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiQuoteTweetServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.RetweeterUserId, 1); }