Example #1
0
        public void CanValidateNullShouldThrow()
        {
            IValueValidator urnValidator = new UrnValidator();

            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentException>(() => { urnValidator.CanValidate(null !); });
        }
Example #2
0
        public void ValidateValidUrnShouldProduceNoErrors()
        {
            IValueValidator urnValidator = new UrnValidator();

            ImmutableArray <ValidationError> validationErrors = urnValidator.Validate("urn", "urn:test:abc");

            Assert.Empty(validationErrors);
        }
Example #3
0
        public void ItShouldValidateNullStringAsInvalid()
        {
            IValueValidator urnValidator = new UrnValidator();

            ImmutableArray <ValidationError> validationErrors = urnValidator.Validate("urn", null);

            Assert.Single(validationErrors);
        }
Example #4
0
        public void CanValidateUrnShouldReturnTrue()
        {
            IValueValidator urnValidator = new UrnValidator();

            bool canValidate = urnValidator.CanValidate("urn");

            Assert.True(canValidate);
        }
Example #5
0
        public void ValidateValidUrnWithWrongTypeShouldProduceNoErrors()
        {
            IValueValidator urnValidator = new UrnValidator();

            Assert.Throws <InvalidOperationException>(() => { urnValidator.Validate("bool", "urn:abc"); });
        }
Example #6
0
        public void CanValidateEmptyShouldThrow()
        {
            IValueValidator urnValidator = new UrnValidator();

            Assert.Throws <ArgumentException>(() => { urnValidator.CanValidate(""); });
        }