2013-03-28 23:07:09 +01:00
|
|
|
|
|
2011-10-24 00:44:37 +02:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
2011-11-13 19:16:31 +01:00
|
|
|
|
using NzbDrone.Test.Common;
|
2011-10-24 00:44:37 +02:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-06-03 08:12:31 +02:00
|
|
|
|
public class WebClientTests : TestBase<HttpProvider>
|
2011-10-24 00:44:37 +02:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
2011-11-17 07:40:54 +01:00
|
|
|
|
public void DownloadString_should_be_able_to_dowload_text_file()
|
2011-10-24 00:44:37 +02:00
|
|
|
|
{
|
2013-06-03 08:12:31 +02:00
|
|
|
|
var jquery = Subject.DownloadString("http://www.google.com/robots.txt");
|
2011-10-24 00:44:37 +02:00
|
|
|
|
|
|
|
|
|
jquery.Should().NotBeBlank();
|
2011-11-17 07:40:54 +01:00
|
|
|
|
jquery.Should().Contain("Sitemap");
|
2011-10-24 00:44:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase("")]
|
|
|
|
|
[TestCase("http://")]
|
|
|
|
|
[TestCase(null)]
|
|
|
|
|
[ExpectedException]
|
|
|
|
|
public void DownloadString_should_throw_on_error(string url)
|
|
|
|
|
{
|
2013-06-03 08:12:31 +02:00
|
|
|
|
var jquery = Subject.DownloadString(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_get_headers()
|
|
|
|
|
{
|
|
|
|
|
Subject.GetHeader("http://www.google.com").Should().NotBeEmpty();
|
2011-10-24 00:44:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-03 08:12:31 +02:00
|
|
|
|
|
2011-10-24 00:44:37 +02:00
|
|
|
|
}
|