public async void LocationId_Create_Valid_Reference() { Mock <ITweetRepository> tweetRepository = new Mock <ITweetRepository>(); tweetRepository.Setup(x => x.LocationByLocationId(It.IsAny <int>())).Returns(Task.FromResult <Location>(new Location())); var validator = new ApiTweetServerRequestModelValidator(tweetRepository.Object); await validator.ValidateCreateAsync(new ApiTweetServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.LocationId, 1); }
public async void UserUserId_Update_Valid_Reference() { Mock <ITweetRepository> tweetRepository = new Mock <ITweetRepository>(); tweetRepository.Setup(x => x.UserByUserUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User())); var validator = new ApiTweetServerRequestModelValidator(tweetRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiTweetServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.UserUserId, 1); }