Exemplo n.º 1
0
        public async void Content_Update_length()
        {
            Mock <ITweetRepository> tweetRepository = new Mock <ITweetRepository>();

            tweetRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Tweet()));

            var validator = new ApiTweetServerRequestModelValidator(tweetRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiTweetServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Content, new string('A', 141));
        }
Exemplo n.º 2
0
        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);
        }