Beispiel #1
0
        public void CanValidateNameNotNull()
        {
            var result = _tagValidator.TestValidate(new TagDto
            {
                Id   = _tags[0].Id,
                Name = null
            });

            result.ShouldHaveValidationErrorFor(c => c.Name);
        }
Beispiel #2
0
        public void CanValidateIdNotEmpty()
        {
            _methodProvider.Setup(p => p.GetMethodUpperName()).Returns("PUT");
            _tagValidator = new TagValidator(_tagValidationService.Object, _categoryValidationService.Object,
                                             _methodProvider.Object);

            var result = _tagValidator.TestValidate(new TagDto
            {
                Id   = Guid.Empty,
                Name = "Pizza"
            });

            result.ShouldHaveValidationErrorFor(c => c.Id);
        }
Beispiel #3
0
        public void CanValidateNameChangedAndNotExists()
        {
            _methodProvider.Setup(p => p.GetMethodUpperName()).Returns("PUT");
            _tagValidator = _tagValidator = new TagValidator(_tagValidationService.Object, _categoryValidationService.Object,
                                                             _methodProvider.Object);

            var result = _tagValidator.TestValidate(new TagDto
            {
                Id   = _tags[1].Id,
                Name = "Pizza"
            });

            result.ShouldHaveValidationErrorFor(c => c.Name);
        }