Esempio n. 1
0
        public void Equals_DifferentSerializerSettings_IsFalse()
        {
            var endpoint1 = new KafkaProducerEndpoint("endpoint")
            {
                Serializer = new JsonMessageSerializer
                {
                    Settings =
                    {
                        MaxDepth = 100
                    }
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("endpoint")
            {
                Serializer = new JsonMessageSerializer
                {
                    Settings =
                    {
                        MaxDepth = 8
                    }
                }
            };

            endpoint1.Equals(endpoint2).Should().BeFalse();
        }
Esempio n. 2
0
        public void Equals_DifferentSerializerSettings_FalseIsReturned()
        {
            var endpoint1 = new KafkaProducerEndpoint("topic")
            {
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 100
                    }
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("topic")
            {
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 8
                    }
                }
            };

            endpoint1.Equals(endpoint2).Should().BeFalse();
        }
Esempio n. 3
0
        public void Equals_SameTopicAndPartition_TrueIsReturned()
        {
            var endpoint1 = new KafkaProducerEndpoint("topic", 1);
            var endpoint2 = new KafkaProducerEndpoint("topic", 1);

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }
        public void Equals_SameSerializerSettings_TrueIsReturned()
        {
            var endpoint1 = new KafkaProducerEndpoint("endpoint")
            {
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 100
                    }
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("endpoint")
            {
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 100
                    }
                }
            };

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }
Esempio n. 5
0
        public void Equals_SameEndpointInstance_IsTrue()
        {
            var endpoint = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.Leader
                }
            };

            endpoint.Equals(endpoint).Should().BeTrue();
        }
Esempio n. 6
0
        public void Equals_SameEndpointInstance_TrueIsReturned()
        {
            var endpoint = new KafkaProducerEndpoint("topic")
            {
                Configuration =
                {
                    Acks = Acks.Leader
                }
            };

            endpoint.Equals(endpoint).Should().BeTrue();
        }
Esempio n. 7
0
        public void Equals_DifferentConfiguration_IsFalse()
        {
            var endpoint1 = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.Leader
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.All
                }
            };

            endpoint1.Equals(endpoint2).Should().BeFalse();
        }
Esempio n. 8
0
        public void Equals_SameConfiguration_IsTrue()
        {
            var endpoint1 = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.Leader
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.Leader
                }
            };

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }
Esempio n. 9
0
        public void Equals_DifferentTopic_FalseIsReturned()
        {
            var endpoint1 = new KafkaProducerEndpoint("topic")
            {
                Configuration =
                {
                    Acks = Acks.Leader
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("topic2")
            {
                Configuration =
                {
                    Acks = Acks.Leader
                }
            };

            endpoint1.Equals(endpoint2).Should().BeFalse();
        }
Esempio n. 10
0
        public void Equals_SameConfiguration_TrueIsReturned()
        {
            var endpoint1 = new KafkaProducerEndpoint("topic")
            {
                Configuration =
                {
                    Acks = Acks.Leader
                }
            };

            var endpoint2 = new KafkaProducerEndpoint("topic")
            {
                Configuration =
                {
                    Acks = Acks.Leader
                }
            };

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }
Esempio n. 11
0
        public void Equals_DeserializedEndpointWithSameConfiguration_IsTrue()
        {
            var endpoint1 = new KafkaProducerEndpoint("endpoint")
            {
                Configuration = new KafkaProducerConfig
                {
                    Acks = Confluent.Kafka.Acks.Leader
                }
            };

            var json = JsonConvert.SerializeObject(endpoint1,
                                                   new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            });

            var endpoint2 = JsonConvert.DeserializeObject <KafkaProducerEndpoint>(json,
                                                                                  new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.Auto
            });

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }