示例#1
0
 public void UriBuilderToStringWithImpliedPorts()
 {
     Assert.AreEqual("http://localhost/p?q#f",
                     UriUtil.UriBuilderToStringWithImpliedPorts(new UriBuilder("http://localhost:80/p?q#f")));
     Assert.AreEqual("https://localhost/p?q#f",
                     UriUtil.UriBuilderToStringWithImpliedPorts(new UriBuilder("https://localhost:443/p?q#f")));
     // Switch it up to make sure that ports are explicitly given where required.
     Assert.AreEqual("http://localhost:443/p?q#f",
                     UriUtil.UriBuilderToStringWithImpliedPorts(new UriBuilder("http://localhost:443/p?q#f")));
     Assert.AreEqual("https://localhost:80/p?q#f",
                     UriUtil.UriBuilderToStringWithImpliedPorts(new UriBuilder("https://localhost:80/p?q#f")));
     // and some random ports
     Assert.AreEqual("https://localhost:5000/p?q#f",
                     UriUtil.UriBuilderToStringWithImpliedPorts(new UriBuilder("https://localhost:5000/p?q#f")));
 }