public void Common_StringValidator_ValidateRequireAttribute_ShouldThrowExceptionForNameAndSubject_WithEmptyNameAndSubject()
        {
            CustomAttributeObject obj = new CustomAttributeObject(string.Empty, string.Empty);
            IValidationException  ex  = ValidationHelper.Validate(obj);

            Assert.IsTrue(ex.Errors.Count == 2 && ex.HasExceptionKey(ValidateRequireAttribute.NameExceptionKey));
            Assert.IsTrue(ex.Errors.Count == 2 && ex.HasExceptionKey(ValidateRequireAttribute.SubjectExceptionKey));
        }
        public void Common_StringValidator_ValidateValueInRangeAttribute_ShouldThrowException_WithValueGreaterThanUpperBound()
        {
            CustomAttributeObject obj = new CustomAttributeObject("123456789123456798");
            IValidationException  ex  = ValidationHelper.Validate(obj);

            Assert.IsTrue(ex.Errors.Count == 1 && ex.HasExceptionKey(ValidateValueInRangeAttribute.NameExceptionKey));
        }
        public void Common_StringValidator_ValidateValueInRangeAttribute_ShouldThrowException_WithEmptyValue()
        {
            CustomAttributeObject obj = new CustomAttributeObject(string.Empty);
            IValidationException  ex  = ValidationHelper.Validate(obj);

            Assert.IsTrue(ex.HasExceptionKey(ValidateValueInRangeAttribute.NameExceptionKey));
        }
        public void Common_StringValidator_ValidateValueInCollectionAttribute_ShouldThrowException_WithInvalidNumber()
        {
            CustomAttributeObject obj = new CustomAttributeObject("abc");
            IValidationException  ex  = ValidationHelper.Validate(obj);

            Assert.IsTrue(ex.HasExceptionKey(ValidateValueInCollectionAttribute.NameExceptionKey));
        }
        public void Common_Validator_ValidateUniqueAttribute_ShouldThrowException_WithDuplicatedName()
        {
            CreatePermissionRequest request = new CreatePermissionRequest("abc", "dsfsdfs", "sdfdfs");
            IPermissionService      service = IoC.Container.Resolve <IPermissionService>();

            service.Create(request);

            CustomAttributeObject obj = new CustomAttributeObject("abc");
            IValidationException  ex  = ValidationHelper.Validate(obj);

            Assert.IsTrue(ex.HasExceptionKey(ValidateUniqueAttribute.NameExceptionKey));
        }