//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void trailingColonIgnored() public virtual void TrailingColonIgnored() { // when OptionalHostnamePort optionalHostnamePort = toOptionalHostnamePortFromRawAddress("localhost::"); // then assertEquals("localhost", optionalHostnamePort.Hostname.get()); assertFalse(optionalHostnamePort.Port.HasValue); assertFalse(optionalHostnamePort.UpperRangePort.HasValue); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void ipv6Works() public virtual void Ipv6Works() { // with string full = "1234:5678:9abc:def0:1234:5678:9abc:def0"; IList <Pair <string, OptionalHostnamePort> > cases = Arrays.asList(Pair.of("[::1]", new OptionalHostnamePort("::1", null, null)), Pair.of("[3FFe::1]", new OptionalHostnamePort("3FFe::1", null, null)), Pair.of("[::1]:2", new OptionalHostnamePort("::1", 2, 2)), Pair.of("[" + full + "]", new OptionalHostnamePort(full, null, null)), Pair.of("[" + full + "]" + ":5432", new OptionalHostnamePort(full, 5432, 5432)), Pair.of("[1::2]:3-4", new OptionalHostnamePort("1::2", 3, 4))); foreach (Pair <string, OptionalHostnamePort> useCase in cases) { // given string caseInput = useCase.First(); OptionalHostnamePort caseOutput = useCase.Other(); // when OptionalHostnamePort optionalHostnamePort = toOptionalHostnamePortFromRawAddress(caseInput); // then string msg = string.Format("\"{0}\" -> {1}", caseInput, caseOutput); assertEquals(msg, caseOutput.Hostname, optionalHostnamePort.Hostname); assertEquals(msg, caseOutput.Port, optionalHostnamePort.Port); assertEquals(msg, caseOutput.UpperRangePort, optionalHostnamePort.UpperRangePort); } }