public void Should_remove_leading_and_trailing_slashes(string entityPathOrName, EntityType entityType, string expectedPathOrName)
        {
            var settings     = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());
            var sanitization = new ValidateAndHashIfNeeded(settings);

            var sanitizedResult = sanitization.Sanitize(entityPathOrName, entityType);

            Assert.That(sanitizedResult, Is.EqualTo(expectedPathOrName));
        }
        public void Should_not_change_valid_paths_or_names(string entityPathOrName, EntityType entityType)
        {
            var settings     = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());
            var sanitization = new ValidateAndHashIfNeeded(settings);

            var sanitizedResult = sanitization.Sanitize(entityPathOrName, entityType);

            Assert.That(sanitizedResult, Is.EqualTo(entityPathOrName));
        }
        public void Should_not_sanitize_characters_passing_default_validation_for_registered_sanitizer(string entityPathOrName, EntityType entityType, string expectedPathOrName)
        {
            var settings     = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());
            var sanitization = new ValidateAndHashIfNeeded(settings);

            var sanitizedResult = sanitization.Sanitize(entityPathOrName, entityType);

            Assert.That(sanitizedResult, Is.EqualTo(expectedPathOrName));
        }
        public void Should_sanitize_longer_than_maximum_path_or_name(string entityPathOrName, EntityType entityType)
        {
            var settings     = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());
            var sanitization = new ValidateAndHashIfNeeded(settings);

            var sanitizedResult = sanitization.Sanitize(entityPathOrName, entityType);

            var expectedPathOrName = MD5DeterministicNameBuilder.Build(entityPathOrName);

            Assert.That(sanitizedResult, Is.EqualTo(expectedPathOrName));
        }
        public void Should_sanitize_invalid_characters_for_registered_sanitizer(string entityPathOrName, EntityType entityType, string expectedPathOrName)
        {
            var settings = new SettingsHolder();

            new DefaultConfigurationValues().Apply(settings);
            var sanitization = new ValidateAndHashIfNeeded(settings);

            var sanitizedResult = sanitization.Sanitize(entityPathOrName, entityType);

            Assert.That(sanitizedResult, Is.EqualTo(expectedPathOrName));
        }