Sonarr/src/NzbDrone.Common.Test/WebClientTests.cs

32 lines
845 B
C#
Raw Normal View History

2013-03-28 22:07:09 +00:00

2013-07-31 06:02:50 +00:00
using System;
2011-10-23 22:44:37 +00:00
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Http;
2011-11-13 18:16:31 +00:00
using NzbDrone.Test.Common;
2011-10-23 22:44:37 +00:00
namespace NzbDrone.Common.Test
{
[TestFixture]
2013-06-03 06:12:31 +00:00
public class WebClientTests : TestBase<HttpProvider>
2011-10-23 22:44:37 +00:00
{
[Test]
2011-11-17 06:40:54 +00:00
public void DownloadString_should_be_able_to_dowload_text_file()
2011-10-23 22:44:37 +00:00
{
2013-06-03 06:12:31 +00:00
var jquery = Subject.DownloadString("http://www.google.com/robots.txt");
2011-10-23 22:44:37 +00:00
2014-08-25 01:28:41 +00:00
jquery.Should().NotBeNullOrWhiteSpace();
2011-11-17 06:40:54 +00:00
jquery.Should().Contain("Sitemap");
2011-10-23 22:44:37 +00:00
}
[TestCase("")]
[TestCase("http://")]
public void DownloadString_should_throw_on_error(string url)
{
Action action = () => Subject.DownloadString(url);
action.Should().Throw<Exception>();
2013-07-31 06:02:50 +00:00
ExceptionVerification.ExpectedWarns(1);
2013-06-03 06:12:31 +00:00
}
2011-10-23 22:44:37 +00:00
}
}