Example #1
0
        public void ThenMoveToKafkaTopic_EndpointBuilder_MovePolicyCreated()
        {
            var builder = new ErrorPolicyChainBuilder(_endpointsConfigurationBuilder);

            builder.ThenMoveToKafkaTopic(endpoint => endpoint.ProduceTo("test-move"));
            var policy = builder.Build();

            policy.Should().BeOfType <MoveMessageErrorPolicy>();
            policy.As <MoveMessageErrorPolicy>().Endpoint.Name.Should().Be("test-move");
            policy.As <MoveMessageErrorPolicy>().Endpoint.As <KafkaProducerEndpoint>().Configuration.BootstrapServers
            .Should().Be("PLAINTEXT://tests");
        }
        public void ThenMoveToMqttTopic_EndpointBuilder_MovePolicyCreated()
        {
            var builder = new ErrorPolicyChainBuilder(_endpointsConfigurationBuilder);

            builder.ThenMoveToMqttTopic(endpoint => endpoint.ProduceTo("test-move"));
            var policy = builder.Build();

            policy.Should().BeOfType <MoveMessageErrorPolicy>();
            policy.As <MoveMessageErrorPolicy>().Endpoint.Name.Should().Be("test-move");
            policy.As <MoveMessageErrorPolicy>().Endpoint
            .As <MqttProducerEndpoint>().Configuration.ChannelOptions
            .As <MqttClientTcpOptions>().Server.Should().Be("tests-server");
        }
Example #3
0
        public void ThenMoveToKafkaTopic_EndpointBuilderWithConfiguration_SkipPolicyCreatedAndConfigurationApplied()
        {
            var builder = new ErrorPolicyChainBuilder(_endpointsConfigurationBuilder);

            builder.ThenMoveToKafkaTopic(
                endpoint => endpoint.ProduceTo("test-move"),
                movePolicy => movePolicy.MaxFailedAttempts(42));
            var policy = builder.Build();

            policy.Should().BeOfType <MoveMessageErrorPolicy>();
            policy.As <MoveMessageErrorPolicy>().Endpoint.Name.Should().Be("test-move");
            policy.As <MoveMessageErrorPolicy>().MaxFailedAttemptsCount.Should().Be(42);
            policy.As <MoveMessageErrorPolicy>().Endpoint.As <KafkaProducerEndpoint>().Configuration.BootstrapServers
            .Should().Be("PLAINTEXT://tests");
        }