Exemplo n.º 1
0
        public void Equals_SameSerializerSettings_TrueIsReturned()
        {
            var endpoint1 = new MqttProducerEndpoint("topic")
            {
                Configuration =
                {
                    ClientId = "client1"
                },
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 100
                    }
                }
            };

            var endpoint2 = new MqttProducerEndpoint("topic")
            {
                Configuration =
                {
                    ClientId = "client1"
                },
                Serializer = new JsonMessageSerializer
                {
                    Options =
                    {
                        MaxDepth = 100
                    }
                }
            };

            endpoint1.Equals(endpoint2).Should().BeTrue();
        }
Exemplo n.º 2
0
        public void Validate_InvalidConfiguration_ExceptionThrown()
        {
            var endpoint = new MqttProducerEndpoint("topic")
            {
                Configuration = new MqttClientConfig()
            };

            Action act = () => endpoint.Validate();

            act.Should().ThrowExactly <EndpointConfigurationException>();
        }
Exemplo n.º 3
0
        public void Equals_SameEndpointInstance_TrueIsReturned()
        {
            var endpoint = new MqttProducerEndpoint("topic")
            {
                Configuration =
                {
                    ClientId = "client1"
                }
            };

            endpoint.Equals(endpoint).Should().BeTrue();
        }
Exemplo n.º 4
0
        public void Validate_MissingTopic_ExceptionThrown()
        {
            var endpoint = new MqttProducerEndpoint(string.Empty)
            {
                Configuration = new MqttClientConfig
                {
                    ChannelOptions = new MqttClientTcpOptions
                    {
                        Server = "test-server"
                    }
                }
            };

            Action act = () => endpoint.Validate();

            act.Should().ThrowExactly <EndpointConfigurationException>();
        }
Exemplo n.º 5
0
        public void Equals_DifferentConfiguration_FalseIsReturned()
        {
            var endpoint1 = new MqttProducerEndpoint("topic")
            {
                Configuration =
                {
                    ClientId = "client1"
                }
            };

            var endpoint2 = new MqttProducerEndpoint("topic")
            {
                Configuration =
                {
                    ClientId = "client2"
                }
            };

            endpoint1.Equals(endpoint2).Should().BeFalse();
        }
Exemplo n.º 6
0
        public void Validate_ChunkingEnabledOnV500_ExceptionThrown()
        {
            var endpoint = new MqttProducerEndpoint("topic")
            {
                Configuration = new MqttClientConfig
                {
                    ChannelOptions = new MqttClientTcpOptions
                    {
                        Server = "test-server"
                    }
                },
                Chunk = new ChunkSettings
                {
                    Size = 10
                }
            };

            Action act = () => endpoint.Validate();

            act.Should().ThrowExactly <EndpointConfigurationException>();
        }