void ValidateAndHashIfNeededOverrides(TransportExtensions <AzureServiceBusTransport> transport) { #region asb-ValidateAndHashIfNeeded-sanitization-overrides var sanitization = transport.Sanitization(); var strategy = sanitization.UseStrategy <ValidateAndHashIfNeeded>(); strategy.QueuePathSanitization(queuePath => "sanitized queuePath"); strategy.TopicPathSanitization(topicPath => "sanitized topicPath"); strategy.SubscriptionNameSanitization( subscriptionNameSanitizer: subscriptionName => { return("sanitized subscriptionName"); }); strategy.RuleNameSanitization( ruleNameSanitizer: ruleName => { return("sanitized ruleName"); }); strategy.Hash( hash: pathOrName => { return("hashed pathOrName"); }); #endregion }
public void Should_be_able_to_set_the_sanitization_strategy() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); var strategy = extensions.Sanitization().UseStrategy <MySanitizationStrategy>(); Assert.AreEqual(typeof(MySanitizationStrategy), strategy.GetSettings().Get <Type>(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.Strategy)); }
public void Should_be_able_to_set_topic_path_sanitizer() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, string> topicPathSanitizer = path => path; var sanitization = extensions.Sanitization().UseStrategy <MySanitizationStrategy>().TopicPathSanitization(topicPathSanitizer); Assert.That(topicPathSanitizer, Is.EqualTo(sanitization.GetSettings().Get <Func <string, string> >(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.TopicPathSanitizer))); }
public void Should_be_able_to_set_rule_name_validator() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, ValidationResult> ruleNameValidator = name => new ValidationResult(); var sanitization = extensions.Sanitization().UseStrategy <MySanitizationStrategy>().RuleNameValidation(ruleNameValidator); Assert.That(ruleNameValidator, Is.EqualTo(sanitization.GetSettings().Get <Func <string, ValidationResult> >(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.RuleNameValidator))); }
public void Should_be_able_to_set_hash() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, string> hash = pathOrName => pathOrName; extensions.Sanitization().UseStrategy <MySanitizationStrategy>().Hash(hash); Assert.That(hash, Is.EqualTo(settings.Get <Func <string, string> >(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.Hash))); }
public void Should_be_able_to_set_subscription_name_sanitizer() { var settings = new SettingsHolder(); var extensions = new TransportExtensions <AzureServiceBusTransport>(settings); Func <string, string> subscriptionNameSanitizer = path => path; extensions.Sanitization().UseStrategy <MySanitizationStrategy>().SubscriptionNameSanitization(subscriptionNameSanitizer); Assert.That(subscriptionNameSanitizer, Is.EqualTo(settings.Get <Func <string, string> >(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.SubscriptionNameSanitizer))); }
void ThrowOnFailedValidationOverrides(TransportExtensions <AzureServiceBusTransport> transport) { #region asb-ThrowOnFailedValidation-sanitization-overrides var sanitization = transport.Sanitization(); var strategy = sanitization.UseStrategy <ThrowOnFailedValidation>(); strategy.QueuePathValidation(queuePath => new ValidationResult()); strategy.TopicPathValidation(topicPath => new ValidationResult()); strategy.SubscriptionNameValidation(subscriptionName => new ValidationResult()); strategy.RuleNameValidation(ruleName => new ValidationResult()); #endregion }
public void Should_be_able_to_set_queue_path_maximum_length() { var validationSettings = extensions.Sanitization().UseQueuePathMaximumLength(10); Assert.AreEqual(10, validationSettings.GetSettings().Get <int>(WellKnownConfigurationKeys.Topology.Addressing.Sanitization.QueuePathMaximumLength)); }