killnine commented on a change in pull request #9: [AMQNET-565] - .net standard conversion, project reorganization URL: https://github.com/apache/activemq-nms-openwire/pull/9#discussion_r301779502
########## File path: test/NMSConnectionFactoryTest.cs ########## @@ -89,6 +68,56 @@ public void TestURI(string connectionURI) } } + [TestCase("activemq:tcp://${activemqhost}:61616/InvalidHost:0")] + [TestCase("activemq:tcp://${activemqhost}:61616/0.0.0.0:-1")] + [TestCase("tcp://InvalidHost:61616")] + [TestCase("activemq:tcp://InvalidHost:61616")] + [TestCase("activemq:tcp://InvalidHost:61616?connection.asyncclose=false")] + + [TestCase("tcp://${activemqhost}:61616?connection.InvalidParameter=true")] + [TestCase("activemq:tcp://${activemqhost}:61616?connection.InvalidParameter=true")] + [TestCase("activemq:failover:tcp://${activemqhost}:61616?connection.InvalidParameter=true")] + [TestCase("activemq:failover:(tcp://${activemqhost}:61616)?connection.InvalidParameter=true")] + [TestCase("activemq:failover:(tcp://${activemqhost}:61616,tcp://${activemqbackuphost}:61616)?connection.InvalidParameter=true")] + + [TestCase("ftp://${activemqhost}:61616")] + [TestCase("http://${activemqhost}:61616")] + [TestCase("discovery://${activemqhost}:6155")] + [TestCase("sms://${activemqhost}:61616")] + [TestCase("activemq:multicast://${activemqhost}:6155")] + [TestCase("activemq:(tcp://${activemqhost}:61616)?connection.asyncClose=false")] + public void TestURIFailures_NMSConnectionException(string connectionURI) + { + Assert.Throws<NMSConnectionException>(() => + { + NMSConnectionFactory factory = new NMSConnectionFactory(NMSTestSupport.ReplaceEnvVar(connectionURI)); + Assert.IsNotNull(factory); + Assert.IsNotNull(factory.ConnectionFactory); + using(IConnection connection = factory.CreateConnection("", "")) + { + Assert.IsNotNull(connection); + connection.Close(); + } + }); + } + + [TestCase("(tcp://${activemqhost}:61616,tcp://${activemqhost}:61616)")] + [TestCase("tcp://${activemqhost}:61616,tcp://${activemqhost}:61616")] + public void TestURIFailures_UriFormatException(string connectionURI) Review comment: Because `ExpectedException` was deprecated in NUnit3, I split up these tests from the ones above. They expect a different exception to be thrown and it was easier to break them up than re-create the ExpectedException logic in the `[TestCase]` attribute. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services