コード例 #1
0
        public async void ReplierUserId_Create_Valid_Reference()
        {
            Mock <IReplyRepository> replyRepository = new Mock <IReplyRepository>();

            replyRepository.Setup(x => x.UserByReplierUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User()));

            var validator = new ApiReplyServerRequestModelValidator(replyRepository.Object);
            await validator.ValidateCreateAsync(new ApiReplyServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.ReplierUserId, 1);
        }
コード例 #2
0
        public async void Content_Create_length()
        {
            Mock <IReplyRepository> replyRepository = new Mock <IReplyRepository>();

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

            var validator = new ApiReplyServerRequestModelValidator(replyRepository.Object);
            await validator.ValidateCreateAsync(new ApiReplyServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Content, new string('A', 141));
        }