Beispiel #1
0
        public async void Title_Update_length()
        {
            Mock <IPostsRepository> postsRepository = new Mock <IPostsRepository>();

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

            var validator = new ApiPostsRequestModelValidator(postsRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPostsRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Title, new string('A', 251));
        }
Beispiel #2
0
        public async void LastEditorDisplayName_Create_length()
        {
            Mock <IPostsRepository> postsRepository = new Mock <IPostsRepository>();

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

            var validator = new ApiPostsRequestModelValidator(postsRepository.Object);
            await validator.ValidateCreateAsync(new ApiPostsRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.LastEditorDisplayName, new string('A', 41));
        }