Canonicalize.Strategies.HostStrategy.Apply C# (CSharp) Method

Apply() public method

Replaces the host part of the URL with the canonical host.
public Apply ( UriBuilder uri ) : void
uri System.UriBuilder The URL to be canonicalized.
return void
        public void Apply(UriBuilder uri)
        {
            uri.Host = _host;
        }

Usage Example

Ejemplo n.º 1
0
        public void AssertUrlChange(string originalUrl, string expectedCanonicalUrl)
        {
            var uriBuilder = new UriBuilder(originalUrl);

            IUrlStrategy strategy = new HostStrategy("example.net");
            strategy.Apply(uriBuilder);

            Assert.That(uriBuilder.Uri, Is.EqualTo(new Uri(expectedCanonicalUrl)));
        }