예제 #1
0
        public void when_serializer_factory_set_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);

            sut.WithSerializerFactory <ConfigurationTests.SerializerFactory>().Should().BeSameAs(sut);
            configuration.SerializerFactoryType.Should().Be <ConfigurationTests.SerializerFactory>();
        }
예제 #2
0
        public void when_header_value_codec_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);

            sut.WithHeaderValueCodec <ConfigurationTests.HeaderValueCodec>().Should().BeSameAs(sut);
            configuration.HeaderValueCodecType.Should().Be <ConfigurationTests.HeaderValueCodec>();
        }
예제 #3
0
        public void when_producer_configurator_set_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);

            sut.WithProducerConfigurator <ConfigurationTests.ProducerConfigurator>().Should().BeSameAs(sut);
            configuration.ProducerConfiguratorType.Should().Be <ConfigurationTests.ProducerConfigurator>();
        }
예제 #4
0
        public void when_producer_config_set_with_invalid_arguments_it_should_fail()
        {
            var    configuration = new BrokerEgressKafkaDriverConfiguration();
            var    configurator  = new BrokerEgressKafkaDriverConfigurator(configuration);
            Action sut           = () => configurator.WithProducerConfig(producerConfig: null);

            sut.Should().ThrowExactly <ArgumentNullException>();
        }
예제 #5
0
        public void when_default_producer_factory_set_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);

            sut.WithDefaultProducerFactory().Should().BeSameAs(sut);
            configuration.ProducerFactoryType.Should().Be <DefaultApiProducerFactory>();
        }
예제 #6
0
        public void when_producer_factory_type_set_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);

            sut.WithProducerFactory <ConfigurationTests.ApiProducerFactory>().Should().BeSameAs(sut);
            configuration.ProducerFactoryType.Should().Be(typeof(ConfigurationTests.ApiProducerFactory));
        }
예제 #7
0
        public void when_constructing_without_registry_it_should_fail()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            // ReSharper disable once ObjectCreationAsStatement
            // ReSharper disable once AssignNullToNotNullAttribute - it's a test against null.
            Action sut = () => new BrokerEgressKafkaDriver(configuration, producerRegistry: null);

            sut.Should().ThrowExactly <ArgumentNullException>().Where(exception => exception.ParamName.Equals("producerRegistry"));
        }
예제 #8
0
        public void when_producer_configuration_set_it_should_be_set_in_configuration()
        {
            var configuration = new BrokerEgressKafkaDriverConfiguration();
            var sut           = new BrokerEgressKafkaDriverConfigurator(configuration);
            var expected      = new ProducerConfig();

            sut.WithProducerConfig(expected).Should().BeSameAs(sut);
            configuration.ProducerConfig.Should().BeSameAs(expected);
        }