public void When_configuring_instance_without_dependencyResolverAdapter_it_should_throw()
            {
                DependencyResolverAdapter dependencyResolverAdapter = null;
                Action act = () =>
                             Configure.With(new BuiltinHandlerActivator()).Options(opts =>
                                                                                   // ReSharper disable once ExpressionIsAlwaysNull
                                                                                   opts.EnableCorrelate(dependencyResolverAdapter)
                                                                                   );

                // Assert
                act.Should()
                .Throw <ArgumentNullException>()
                .Where(exception => exception.ParamName == nameof(dependencyResolverAdapter));
            }
Пример #2
0
        /// <summary>
        /// Configures Rebus to use Correlate as the Correlation ID provider by resolving Correlate dependencies using the specified <paramref name="dependencyResolverAdapter"/>.
        /// </summary>
        /// <param name="configurer">The options configurer.</param>
        /// <param name="dependencyResolverAdapter">The dependency resolver adapter to resolve Correlate dependencies with.</param>
        /// <returns>The <see cref="OptionsConfigurer"/> instance.</returns>
        public static OptionsConfigurer EnableCorrelate(this OptionsConfigurer configurer, DependencyResolverAdapter dependencyResolverAdapter)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }

            if (dependencyResolverAdapter == null)
            {
                throw new ArgumentNullException(nameof(dependencyResolverAdapter));
            }

            // Register Correlate steps using custom resolver.
            return(configurer
                   .RegisterSteps(dependencyResolverAdapter)
                   .ConfigurePipeline());
        }
 public DependencyResolverAdapterTests()
 {
     _sut = new DependencyResolverAdapter(type => _optionalResolve(type));
 }