コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }