Exemple #1
0
        public async void TagName_Update_length()
        {
            Mock <ITagRepository> tagRepository = new Mock <ITagRepository>();

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

            var validator = new ApiTagRequestModelValidator(tagRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiTagRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.TagName, new string('A', 151));
        }
Exemple #2
0
        public async void TagName_Create_null()
        {
            Mock <ITagRepository> tagRepository = new Mock <ITagRepository>();

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

            var validator = new ApiTagRequestModelValidator(tagRepository.Object);
            await validator.ValidateCreateAsync(new ApiTagRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.TagName, null as string);
        }