Exemple #1
0
 public void LocationCorrectAddressWithPortAndHash()
 {
     var hostname = "www.w3.org";
     var protocol = "http:";
     var port = "8080";
     var path = "/some/path";
     var hash = "#myhash";
     var host = hostname + ":" + port;
     var address = protocol + "//" + host + path + hash;
     var location = new Location(address);
     Assert.AreEqual(hash, location.Hash);
     Assert.AreEqual(host, location.Host);
     Assert.AreEqual(hostname, location.HostName);
     Assert.AreEqual(address, location.Href);
     Assert.AreEqual(path, location.PathName);
     Assert.AreEqual(port, location.Port);
     Assert.AreEqual(protocol, location.Protocol);
 }
Exemple #2
0
 public void LocationCorrectAddressWithProtocolChange()
 {
     var hostname = "www.w3.org";
     var protocol = "http:";
     var path = "/some/path";
     var address = protocol + "//" + hostname + path;
     var location = new Location(address);
     Assert.AreEqual(protocol, location.Protocol);
     protocol = "https:";
     location.Protocol = protocol;
     address = protocol + "//" + hostname + path;
     Assert.AreEqual(protocol, location.Protocol);
     Assert.AreEqual(string.Empty, location.Hash);
     Assert.AreEqual(hostname, location.Host);
     Assert.AreEqual(hostname, location.HostName);
     Assert.AreEqual(address, location.Href);
     Assert.AreEqual(path, location.PathName);
     Assert.AreEqual(string.Empty, location.Port);
     Assert.AreEqual(protocol, location.Protocol);
     Assert.AreEqual(address, location.Href);
 }
Exemple #3
0
 public void LocationCorrectAddressWithoutPortButWithHash()
 {
     var hostname = "www.w3.org";
     var protocol = "http:";
     var path = "/some/path";
     var hash = "#myhash";
     var address = protocol + "//" + hostname + path + hash;
     var location = new Location(address);
     Assert.AreEqual(hash, location.Hash);
     Assert.AreEqual(hostname, location.Host);
     Assert.AreEqual(hostname, location.HostName);
     Assert.AreEqual(address, location.Href);
     Assert.AreEqual(path, location.PathName);
     Assert.AreEqual(string.Empty, location.Port);
     Assert.AreEqual(protocol, location.Protocol);
 }