Exemplo n.º 1
0
        [InlineData("", "localhost", null, null, 0, "", "localhost", "guest", "guest", -1)] // Should fill in "guest", "guest", 5672
        public void Handles_Connection_Attributes_And_Options(string connectionString, string hostName, string userName, string password, int port,
                                                              string expectedConnectionString, string expectedHostName, string expectedUserName, string expectedPassword, int expectedPort)
        {
            ConnectionFactory factory = RabbitMQService.GetConnectionFactory(connectionString, hostName, userName, password, port);

            if (String.IsNullOrEmpty(connectionString))
            {
                Assert.Null(factory.Uri);
                Assert.Equal(expectedHostName, factory.HostName);
                Assert.Equal(expectedUserName, factory.UserName);
                Assert.Equal(expectedPassword, factory.Password);
                Assert.Equal(expectedPort, factory.Port);
            }
            else
            {
                Assert.Equal(new Uri(expectedConnectionString), factory.Uri);
                Assert.Equal(expectedHostName, factory.HostName);
                Assert.Equal(expectedUserName, factory.UserName);
                Assert.Equal(expectedPassword, factory.Password);
                Assert.Equal(expectedPort, factory.Port);
            }
        }