public static IngressApiConfiguration With( this IngressApiConfiguration configuration, Action <IngressApiConfiguration> updater) { updater(configuration); return(configuration); }
public void when_key_type_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithMessageKey <int>().Should().BeSameAs(sut); configuration.MessageKeyType.Should().Be <int>(); }
public void when_enter_pipe_fitter_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithPipeFitter <StabPipeFitter>().Should().BeSameAs(sut); configuration.PipeFitterType.Should().Be <StabPipeFitter>(); }
public void when_payload_type_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithMessagePayload <string>().Should().BeSameAs(sut); configuration.MessagePayloadType.Should().Be <string>(); }
public void when_message_type_registry_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithMessageTypesRegistry <MessageTypesRegistry1>().Should().BeSameAs(sut); configuration.MessageTypesRegistryType.Should().Be <MessageTypesRegistry1>(); }
public void when_queue_name_patterns_provider_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithQueueNamePatternsProvider <QueueNamePatternsProvider>().Should().BeSameAs(sut); configuration.QueueNamePatternsProviderType.Should().Be <QueueNamePatternsProvider>(); }
public void when_handler_registry_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); sut.WithHandlerRegistry <HandlerRegistry>().Should().BeSameAs(sut); configuration.HandlerRegistryType.Should().Be <HandlerRegistry>(); }
public void when_same_api_added_second_time_it_should_fail() { var configuration = new BrokerIngressConfiguration(); var api = new IngressApiConfiguration(); Action sut = () => configuration.AddApi(api); sut.Should().NotThrow(); sut.Should().ThrowExactly <PoezdConfigurationException>(); }
public void when_id_set_it_should_be_set_in_configuration() { var configuration = new IngressApiConfiguration(); var sut = new IngressApiConfigurator(configuration); const string expected = "id"; sut.WithId(expected).Should().BeSameAs(sut); configuration.Id.Should().Be(expected); }
public void when_pipe_fitter_set_more_than_once_it_should_fail() { var configuration = new IngressApiConfiguration(); var configurator = new IngressApiConfigurator(configuration); Action sut = () => configurator.WithPipeFitter <StabPipeFitter>(); sut.Should().NotThrow(); configuration.PipeFitterType.Should().Be <StabPipeFitter>(); EnsureSecondCallOfConfigurationMethodFails(sut); }
public void when_payload_type_set_more_than_once_it_should_fail() { var configuration = new IngressApiConfiguration(); var configurator = new IngressApiConfigurator(configuration); Action sut = () => configurator.WithMessagePayload <string>(); sut.Should().NotThrow(); configuration.MessagePayloadType.Should().Be <string>(); EnsureSecondCallOfConfigurationMethodFails(sut); }
public void when_message_type_registry_set_more_than_once_it_should_fail() { var configuration = new IngressApiConfiguration(); var configurator = new IngressApiConfigurator(configuration); Action sut = () => configurator.WithMessageTypesRegistry <MessageTypesRegistry1>(); sut.Should().NotThrow(); configuration.MessageTypesRegistryType.Should().Be <MessageTypesRegistry1>(); EnsureSecondCallOfConfigurationMethodFails(sut); }
public void when_queue_name_patterns_provider_set_more_than_once_it_should_fail() { var configuration = new IngressApiConfiguration(); var configurator = new IngressApiConfigurator(configuration); Action sut = () => configurator.WithQueueNamePatternsProvider <QueueNamePatternsProvider>(); sut.Should().NotThrow(); configuration.QueueNamePatternsProviderType.Should().Be <QueueNamePatternsProvider>(); EnsureSecondCallOfConfigurationMethodFails(sut); }
public void when_id_set_more_than_once_it_should_fail() { var configuration = new IngressApiConfiguration(); var configurator = new IngressApiConfigurator(configuration); const string expected = "id"; Action sut = () => configurator.WithId(expected); sut.Should().NotThrow(); configuration.Id.Should().Be(expected); EnsureSecondCallOfConfigurationMethodFails(sut); }
/// <summary> /// Constructs a new instance of ingress API. /// </summary> /// <param name="configuration"> /// The ingress API configuration. /// </param> /// <param name="serviceProvider"> /// Service provider. /// </param> /// <exception cref="ArgumentNullException"> /// One of arguments is not specified. /// </exception> public IngressApi([NotNull] IngressApiConfiguration configuration, [NotNull] IDiContainerAdapter serviceProvider) { Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } _queueNamePatternsProvider = GetQueueNamePatternsProvider(serviceProvider); MessageTypesRegistry = GetMessageTypesRegistry(serviceProvider); HandlerRegistry = GetHandlerRegistry(serviceProvider); PipeFitter = GetIngressPipeFitter(serviceProvider); }
public void when_api_with_same_id_added_it_should_fail() { var configuration = new BrokerIngressConfiguration(); const string sameId = "same id"; var api1 = new IngressApiConfiguration { Id = sameId }; Action sut1 = () => configuration.AddApi(api1); sut1.Should().NotThrow(); var api2 = new IngressApiConfiguration { Id = sameId }; Action sut2 = () => configuration.AddApi(api2); sut2.Should().ThrowExactly <PoezdConfigurationException>(); }