public void UriExtensions_ResolveRedirects_Facebook()
        {
            Uri uri = new Uri("http://t.co/6VyBZOO");
            Uri expected = new Uri("https://www.facebook.com/photo.php?pid=585685&l=588142298a&id=100399403341183");

            uri.ResolveRedirects().Should().Be(expected);
        }
 public void UriExtensions_ResolveRedirects_ThrowsOnNonWeb()
 {
     Assert.Throws<InvalidOperationException>(() =>
     {
         Uri uri = new Uri("ftp://www.google.com");
         uri.ResolveRedirects();
     });
 }
        public void UriExtensions_ResolveRedirects_ErrorHandling()
        {
            Uri uri = new Uri("http://notfound-asdadagasdg.com");

            Func<WebException, Uri> map = (x) => null;

            uri.ResolveRedirects(map).Should().BeNull();
        }
 public void UriExtensions_ResolveRedirects_TinyUrl()
 {
     Uri uri = new Uri("http://tinyurl.com/3lesxnx");
     uri.ResolveRedirects().Should().Be(new Uri("http://edition.cnn.com/2011/WORLD/europe/07/18/uk.committee.hearing/"));
 }
        public void UriExtensions_ResolveRedirects_HEADnotAllowed()
        {
            Uri uri = new Uri("http://amzn.to/");
            Uri expected = new Uri(@"http://www.amazon.com/");
            Exception ex = null;
            Uri resolved = uri.ResolveRedirects(x => { ex = x; return uri; });

            ex.Should().BeNull();
            uri.ResolveRedirects().Should().Be(expected);
        }