本文整理汇总了C#中AngleSharp.Dom.Location类的典型用法代码示例。如果您正苦于以下问题:C# Location类的具体用法?C# Location怎么用?C# Location使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Location类属于AngleSharp.Dom命名空间,在下文中一共展示了Location类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbsoluteLocationWithoutPathGoogle
public void AbsoluteLocationWithoutPathGoogle()
{
var url = "http://www.google.de";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("www.google.de", location.Host);
Assert.AreEqual(url + "/", location.Href);
Assert.IsFalse(location.IsRelative);
}
示例2: ProtocolRelativeLocationWithPathGoogleApis
public void ProtocolRelativeLocationWithPathGoogleApis()
{
var url = "//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/ajax/libs/jquery/1.4.2/jquery.js", location.PathName);
Assert.AreEqual("", location.Protocol);
Assert.AreEqual("ajax.googleapis.com", location.Host);
Assert.AreEqual(url, location.Href);
Assert.IsTrue(location.IsRelative);
}
示例3: AbsoluteLocationWithPortAndQueryLocalhost
public void AbsoluteLocationWithPortAndQueryLocalhost()
{
var url = "http://localhost:8080/?mytest";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("8080", location.Port);
Assert.AreEqual("?mytest", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("localhost:8080", location.Host);
Assert.AreEqual("localhost", location.HostName);
Assert.AreEqual(url, location.Href);
Assert.IsFalse(location.IsRelative);
}
示例4: DataLocationSchemeOnly
public void DataLocationSchemeOnly()
{
var url = "data:";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("data:", location.Protocol);
Assert.AreEqual("", location.Host);
Assert.AreEqual("", location.HostName);
Assert.AreEqual(url, location.Href);
Assert.IsFalse(location.IsRelative);
}
示例5: Document
/// <summary>
/// Creates a new document node.
/// </summary>
/// <param name="context">The context of the document.</param>
/// <param name="source">The underlying source.</param>
internal Document(IBrowsingContext context, TextSource source)
: base(null, "#document", NodeType.Document)
{
_async = true;
_designMode = false;
_firedUnload = false;
_salvageable = true;
_shown = false;
_preferredStyleSheetSet = String.Empty;
_context = context ?? BrowsingContext.New();
_source = source;
_referrer = String.Empty;
_contentType = MimeTypes.ApplicationXml;
_ready = DocumentReadyState.Loading;
_sandbox = Sandboxes.None;
_quirksMode = QuirksMode.Off;
_tasks = new CancellableTasks();
_mutations = new MutationHost(Options);
_loadingScripts = new Queue<HtmlScriptElement>();
_location = new Location(AboutBlank);
_ranges = new List<WeakReference<Range>>();
_location.Changed += LocationChanged;
_styleSheets = this.CreateStyleSheets();
_view = this.CreateWindow();
_loader = this.CreateLoader();
}
示例6: LocationCorrectAddressWithPathChange
public void LocationCorrectAddressWithPathChange()
{
var hostname = "www.w3.org";
var protocol = "http:";
var path = "/some/path";
var address = protocol + "//" + hostname + path;
var location = new Location(address);
Assert.AreEqual(path, location.PathName);
path = "/";
location.PathName = "";
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);
}
示例7: RelativeLocationEmpty
public void RelativeLocationEmpty()
{
var url = "";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("", location.Protocol);
Assert.AreEqual("", location.Host);
Assert.AreEqual(url, location.Href);
Assert.IsTrue(location.IsRelative);
}
示例8: AbsoluteLocationUnicodeLetters
public void AbsoluteLocationUnicodeLetters()
{
var url = "http://www.詹姆斯.com/atomtests/iri/詹.html";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/atomtests/iri/%E8%A9%B9.html", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("www.詹姆斯.com", location.Host);
Assert.AreEqual("http://www.詹姆斯.com/atomtests/iri/%E8%A9%B9.html", location.Href);
Assert.IsFalse(location.IsRelative);
}
示例9: RelativeLocationWithoutProtocol
public void RelativeLocationWithoutProtocol()
{
var url = "//example.com/";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("", location.Protocol);
Assert.AreEqual("example.com", location.Host);
Assert.AreEqual(url, location.Href);
Assert.IsTrue(location.IsRelative);
}
示例10: RelativeLocationOneUp
public void RelativeLocationOneUp()
{
var url = "mid/content=5/../6";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/mid/6", location.PathName);
Assert.AreEqual("", location.Protocol);
Assert.AreEqual("", location.Host);
Assert.AreEqual("mid/6", location.Href);
Assert.IsTrue(location.IsRelative);
}
示例11: AbsoluteLocationCurrentDirectory
public void AbsoluteLocationCurrentDirectory()
{
var url = "http://example.com/%2E/";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("example.com", location.Host);
Assert.AreEqual("http://example.com/", location.Href);
Assert.IsFalse(location.IsRelative);
}
示例12: AbsoluteLocationQueryString
public void AbsoluteLocationQueryString()
{
var url = "http://example.com/?q=string";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("?q=string", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("example.com", location.Host);
Assert.AreEqual(url, location.Href);
Assert.IsFalse(location.IsRelative);
}
示例13: AbsoluteLocationPercentPathDouble
public void AbsoluteLocationPercentPathDouble()
{
var url = "http://example.com/%25C3%2587";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/%25C3%2587", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("example.com", location.Host);
Assert.AreEqual(url, location.Href);
Assert.IsFalse(location.IsRelative);
}
示例14: RelativeLocationGoingUpAndDown
public void RelativeLocationGoingUpAndDown()
{
var url = "/a/b/c/./../../g";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/a/g", location.PathName);
Assert.AreEqual("", location.Protocol);
Assert.AreEqual("", location.Host);
Assert.AreEqual("a/g", location.Href);
Assert.IsTrue(location.IsRelative);
}
示例15: AbsoluteLocationGoingUpToRoot
public void AbsoluteLocationGoingUpToRoot()
{
var url = "http://example.com/../..";
var location = new Location(url);
Assert.AreEqual("", location.Hash);
Assert.AreEqual("", location.Port);
Assert.AreEqual("", location.Search);
Assert.AreEqual("/", location.PathName);
Assert.AreEqual("http:", location.Protocol);
Assert.AreEqual("example.com", location.Host);
Assert.AreEqual("http://example.com/", location.Href);
Assert.IsFalse(location.IsRelative);
}