diff --git a/NzbDrone.Common.Test/WebClientTests.cs b/NzbDrone.Common.Test/WebClientTests.cs index c4a7b7413..9c621cde4 100644 --- a/NzbDrone.Common.Test/WebClientTests.cs +++ b/NzbDrone.Common.Test/WebClientTests.cs @@ -11,7 +11,7 @@ public class WebClientTests : TestBase [Test] public void DownloadString_should_be_able_to_dowload_text_file() { - var jquery = new HttpProvider().DownloadString("http://www.google.com/robots.txt"); + var jquery = new HttpProvider(new EnvironmentProvider()).DownloadString("http://www.google.com/robots.txt"); jquery.Should().NotBeBlank(); jquery.Should().Contain("Sitemap"); @@ -23,7 +23,7 @@ public void DownloadString_should_be_able_to_dowload_text_file() [ExpectedException] public void DownloadString_should_throw_on_error(string url) { - var jquery = new HttpProvider().DownloadString(url); + var jquery = new HttpProvider(new EnvironmentProvider()).DownloadString(url); } } } diff --git a/NzbDrone.Common/HttpProvider.cs b/NzbDrone.Common/HttpProvider.cs index 99fef0b1a..86efab450 100644 --- a/NzbDrone.Common/HttpProvider.cs +++ b/NzbDrone.Common/HttpProvider.cs @@ -1,5 +1,4 @@ -using System.Linq; -using System; +using System; using System.Diagnostics; using System.IO; using System.Net; @@ -8,7 +7,17 @@ namespace NzbDrone.Common { - public class HttpProvider + public interface IHttpProvider + { + string DownloadString(string address); + string DownloadString(string address, string username, string password); + string DownloadString(string address, ICredentials identity); + Stream DownloadStream(string url, NetworkCredential credential = null); + void DownloadFile(string url, string fileName); + string PostCommand(string address, string username, string password, string command); + } + + public class HttpProvider : IHttpProvider { private readonly EnvironmentProvider _environmentProvider; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); @@ -20,21 +29,17 @@ public HttpProvider(EnvironmentProvider environmentProvider) _userAgent = String.Format("NzbDrone {0}", _environmentProvider.Version); } - public HttpProvider() - { - } - - public virtual string DownloadString(string address) + public string DownloadString(string address) { return DownloadString(address, null); } - public virtual string DownloadString(string address, string username, string password) + public string DownloadString(string address, string username, string password) { return DownloadString(address, new NetworkCredential(username, password)); } - public virtual string DownloadString(string address, ICredentials identity) + public string DownloadString(string address, ICredentials identity) { try { @@ -49,7 +54,7 @@ public virtual string DownloadString(string address, ICredentials identity) } } - public virtual Stream DownloadStream(string url, NetworkCredential credential = null) + public Stream DownloadStream(string url, NetworkCredential credential = null) { var request = (HttpWebRequest)WebRequest.Create(url); request.UserAgent = _userAgent; @@ -60,7 +65,7 @@ public virtual Stream DownloadStream(string url, NetworkCredential credential = return response.GetResponseStream(); } - public virtual void DownloadFile(string url, string fileName) + public void DownloadFile(string url, string fileName) { try { @@ -87,7 +92,7 @@ public virtual void DownloadFile(string url, string fileName) } } - public virtual string PostCommand(string address, string username, string password, string command) + public string PostCommand(string address, string username, string password, string command) { address = String.Format("http://{0}/jsonrpc", address); diff --git a/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs b/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs index a4398f3a4..c01b1efdc 100644 --- a/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs +++ b/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs @@ -26,7 +26,7 @@ public void Setup() [Test] public void fetch_should_return_list_of_mappings() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(SCENE_MAPPING_URL)) .Returns(ReadAllText("Files", "SceneMappings.json")); @@ -43,7 +43,7 @@ public void fetch_should_return_list_of_mappings() [Test] public void should_throw_on_server_error() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(SCENE_MAPPING_URL)) .Throws(new WebException()); Assert.Throws(() => Subject.Fetch()); @@ -52,7 +52,7 @@ public void should_throw_on_server_error() [Test] public void should_throw_on_bad_json() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(SCENE_MAPPING_URL)) .Returns("bad json"); Assert.Throws(() => Subject.Fetch()); diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs index 72a4394a4..246dbfb8c 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs @@ -33,7 +33,7 @@ private void WithExistingFile() private void WithFailedDownload() { - Mocker.GetMock().Setup(c => c.DownloadFile(It.IsAny(), It.IsAny())).Throws(new WebException()); + Mocker.GetMock().Setup(c => c.DownloadFile(It.IsAny(), It.IsAny())).Throws(new WebException()); } [Test] @@ -41,7 +41,7 @@ public void DownloadNzb_should_download_file_if_it_doesnt_exist() { Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath), Times.Once()); + Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath), Times.Once()); } [Test] @@ -51,7 +51,7 @@ public void DownloadNzb_not_download_file_if_it_doesn_exist() Subject.DownloadNzb(nzbUrl, title, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); } [Test] @@ -72,7 +72,7 @@ public void should_replace_illegal_characters_in_title() Subject.DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); } } } diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs index 8aaed0d77..e53b6c4de 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs @@ -27,7 +27,7 @@ public void Setup() private void WithFailResponse() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny())) .Returns(ReadAllText("Files", "Nzbget", "JsonError.txt")); } @@ -38,7 +38,7 @@ public void should_add_item_to_queue() const string url = "http://www.nzbdrone.com"; const string title = "30 Rock - S01E01 - Pilot [HDTV-720p]"; - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.Is(c => c.Equals("{\"method\":\"appendurl\",\"params\":[\"30 Rock - S01E01 - Pilot [HDTV-720p]\",\"TV\",0,false,\"http://www.nzbdrone.com\"]}")))) .Returns("{\"version\": \"1.1\",\"result\": true}"); diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs index e081053dd..23d7b013e 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs @@ -26,21 +26,21 @@ public void Setup() private void WithFullQueue() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny())) .Returns(ReadAllText("Files", "Nzbget", "Queue.txt")); } private void WithEmptyQueue() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny())) .Returns(ReadAllText("Files", "Nzbget", "Queue_empty.txt")); } private void WithFailResponse() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.PostCommand("192.168.5.55:6789", "nzbget", "pass", It.IsAny())) .Returns(ReadAllText("Files", "Nzbget", "JsonError.txt")); } diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs index 2e49939bf..56c35fd0c 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs @@ -36,7 +36,7 @@ private void WithExistingFile() private void WithFailedDownload() { - Mocker.GetMock().Setup(c => c.DownloadFile(It.IsAny(), It.IsAny())).Throws(new WebException()); + Mocker.GetMock().Setup(c => c.DownloadFile(It.IsAny(), It.IsAny())).Throws(new WebException()); } [Test] @@ -44,7 +44,7 @@ public void should_download_file_if_it_doesnt_exist() { Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once()); + Mocker.GetMock().Verify(c => c.DownloadFile(nzbUrl, nzbPath),Times.Once()); } [Test] @@ -54,7 +54,7 @@ public void should_not_download_file_if_it_doesn_exist() Mocker.Resolve().DownloadNzb(nzbUrl, title, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), It.IsAny()), Times.Never()); } [Test] @@ -81,7 +81,7 @@ public void should_replace_illegal_characters_in_title() Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle, false).Should().BeTrue(); - Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); } } } diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs index 61a8da6ac..7c6eac4fb 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs @@ -41,7 +41,7 @@ public void Setup() private void WithFullQueue() { - Mocker.GetMock() + Mocker.GetMock() .Setup( s => s.DownloadString( @@ -51,20 +51,20 @@ private void WithFullQueue() private void WithEmptyQueue() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","QueueEmpty.txt")); } private void WithFailResponse() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(It.IsAny())).Returns(ReadAllText("Files","JsonError.txt")); } private void WithUnknownPriorityQueue() { - Mocker.GetMock() + Mocker.GetMock() .Setup( s => s.DownloadString( diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs index 2264b01b5..64b60c9f3 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs @@ -33,14 +33,14 @@ public void Setup() private void WithFailResponse() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(It.IsAny())).Returns("{ \"status\": false, \"error\": \"API Key Required\" }"); } [Test] public void add_url_should_format_request_properly() { - Mocker.GetMock(MockBehavior.Strict) + Mocker.GetMock(MockBehavior.Strict) .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); @@ -70,7 +70,7 @@ public void should_be_able_to_get_categories_when_config_is_passed_in() - Mocker.GetMock(MockBehavior.Strict) + Mocker.GetMock(MockBehavior.Strict) .Setup(s => s.DownloadString("http://192.168.5.22:1111/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d2&ma_username=admin2&ma_password=pass2")) .Returns(ReadAllText("Files","Categories_json.txt")); @@ -85,7 +85,7 @@ public void should_be_able_to_get_categories_when_config_is_passed_in() [Test] public void should_be_able_to_get_categories_using_config() { - Mocker.GetMock(MockBehavior.Strict) + Mocker.GetMock(MockBehavior.Strict) .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","Categories_json.txt")); @@ -100,7 +100,7 @@ public void should_be_able_to_get_categories_using_config() [Test] public void GetHistory_should_return_a_list_with_items_when_the_history_has_items() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files", "History.txt")); @@ -114,7 +114,7 @@ public void GetHistory_should_return_a_list_with_items_when_the_history_has_item [Test] public void GetHistory_should_return_an_empty_list_when_the_queue_is_empty() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","HistoryEmpty.txt")); @@ -128,7 +128,7 @@ public void GetHistory_should_return_an_empty_list_when_the_queue_is_empty() [Test] public void GetHistory_should_return_an_empty_list_when_there_is_an_error_getting_the_queue() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","JsonError.txt")); @@ -141,7 +141,7 @@ public void GetVersion_should_return_the_version_using_passed_in_values() { var response = "{ \"version\": \"0.6.9\" }"; - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); @@ -158,7 +158,7 @@ public void GetVersion_should_return_the_version_using_saved_values() { var response = "{ \"version\": \"0.6.9\" }"; - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); @@ -175,7 +175,7 @@ public void Test_should_return_version_as_a_string() { var response = "{ \"version\": \"0.6.9\" }"; - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); @@ -189,7 +189,7 @@ public void Test_should_return_version_as_a_string() [Test] public void should_return_false_when_WebException_is_thrown() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString(It.IsAny())).Throws(new WebException()); Mocker.Resolve().DownloadNzb(url, title, false).Should().BeFalse(); @@ -207,14 +207,14 @@ public void downloadNzb_should_use_sabRecentTvPriority_when_recentEpisode_is_tru .SetupGet(s => s.SabBacklogTvPriority) .Returns(SabPriorityType.Low); - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); Mocker.Resolve().DownloadNzb(url, title, true).Should().BeTrue(); - Mocker.GetMock() + Mocker.GetMock() .Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once()); } @@ -229,14 +229,14 @@ public void downloadNzb_should_use_sabBackogTvPriority_when_recentEpisode_is_fal .SetupGet(s => s.SabBacklogTvPriority) .Returns(SabPriorityType.Low); - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); Mocker.Resolve().DownloadNzb(url, title, false).Should().BeTrue(); - Mocker.GetMock() + Mocker.GetMock() .Verify(v => v.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"), Times.Once()); } } diff --git a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs index 8c96f4602..3d6a4773a 100644 --- a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs +++ b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs @@ -73,7 +73,7 @@ public void Should_download_update_package() StartUpdate(); - Mocker.GetMock().Verify( + Mocker.GetMock().Verify( c => c.DownloadFile(updatePackage.Url, updateArchive)); } diff --git a/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs b/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs index a43b8c178..c60425fac 100644 --- a/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs +++ b/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs @@ -1,10 +1,7 @@ -using System.Linq; -using NUnit.Framework; +using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.MediaCover; using NzbDrone.Core.Test.Framework; -using NzbDrone.Core.Tv; -using NzbDrone.Core.Tv.Events; namespace NzbDrone.Core.Test.MediaCoverTests { @@ -14,7 +11,7 @@ public class MediaCoverServiceFixture : CoreTest [SetUp] public void Setup() { - Mocker.SetConstant(new HttpProvider()); + Mocker.SetConstant(new HttpProvider(new EnvironmentProvider())); Mocker.SetConstant(new DiskProvider()); Mocker.SetConstant(new EnvironmentProvider()); } diff --git a/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs index 91c5d725f..dcdbee8ea 100644 --- a/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs @@ -54,7 +54,7 @@ public void GetSectionKeys_should_return_single_section_key_when_only_one_show_s var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); - Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) + Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); @@ -73,7 +73,7 @@ public void GetSectionKeys_should_return_single_section_key_when_only_one_show_s var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); - Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) + Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); @@ -92,7 +92,7 @@ public void GetSectionKeys_should_return_multiple_section_keys_when_there_are_mu var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); - Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) + Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); @@ -112,7 +112,7 @@ public void UpdateSection_should_update_section() var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); - Mocker.GetMock().Setup(s => s.DownloadString("http://localhost:32400/library/sections/5/refresh")) + Mocker.GetMock().Setup(s => s.DownloadString("http://localhost:32400/library/sections/5/refresh")) .Returns(response); @@ -133,7 +133,7 @@ public void Notify_should_send_notification_for_single_client_when_only_one_is_c var expectedUrl = String.Format("http://localhost:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification({0}, {1}))", header, message); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(expectedUrl)) .Returns("ok"); @@ -153,7 +153,7 @@ public void Notify_should_send_notifcation_to_all_configured_clients() const string header = "Test Header"; const string message = "Test Message"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(It.IsAny())) .Returns("ok"); @@ -176,7 +176,7 @@ public void Notify_should_send_notification_with_credentials_when_configured() var expectedUrl = String.Format("http://localhost:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn(Notification({0}, {1}))", header, message); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(expectedUrl, "plex", "plex")) .Returns("ok"); @@ -197,7 +197,7 @@ public void Notify_should_send_notification_with_credentials_when_configured_for const string header = "Test Header"; const string message = "Test Message"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(It.IsAny(), "plex", "plex")) .Returns("ok"); diff --git a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs index 3d29f418c..269a4944b 100644 --- a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs @@ -98,7 +98,7 @@ public void GetJsonVersionIntOnly(int number) { var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":" + number + "}}"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); @@ -118,7 +118,7 @@ public void GetJsonVersionFrodo(int major, int minor, int patch) { var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":{\"major\":" + major + ",\"minor\":" + minor + ",\"patch\":" + patch + "}}}"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); @@ -134,7 +134,7 @@ public void GetJsonVersion_error() { var message = "{\"error\":{\"code\":-32601,\"message\":\"Method not found.\"},\"id\":10,\"jsonrpc\":\"2.0\"}"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); @@ -164,7 +164,7 @@ public void GetActivePlayersDharma(bool audio, bool picture, bool video) + video.ToString().ToLower() + "}}"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); @@ -183,7 +183,7 @@ public void GetActivePlayersEden_should_be_empty_when_no_active_players() WithNoActivePlayers(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); @@ -200,7 +200,7 @@ public void GetActivePlayersEden_should_have_active_video_player() WithVideoPlayerActive(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); @@ -218,7 +218,7 @@ public void GetActivePlayersEden_should_have_active_audio_player() WithAudioPlayerActive(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); @@ -236,7 +236,7 @@ public void GetActivePlayersEden_should_have_active_picture_player() WithPicturePlayerActive(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); @@ -254,7 +254,7 @@ public void GetActivePlayersEden_should_have_all_players_active() WithAllPlayersActive(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); @@ -275,7 +275,7 @@ public void GetTvShowsJson() var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); @@ -324,7 +324,7 @@ public void SendCommand() var url = String.Format("http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(CleanLibrary(video))"); //var fakeUdpProvider = Mocker.GetMock(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("Ok\n"); @@ -353,7 +353,7 @@ public void GetXbmcSeriesPath_true() //var fakeUdpProvider = Mocker.GetMock(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(setResponseUrl, username, password)).Returns("OK"); fakeHttp.Setup(s => s.DownloadString(resetResponseUrl, username, password)).Returns(@"
  • OK @@ -386,7 +386,7 @@ public void GetXbmcSeriesPath_false() //var fakeUdpProvider = Mocker.GetMock(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(setResponseUrl, username, password)).Returns("OK"); fakeHttp.Setup(s => s.DownloadString(resetResponseUrl, username, password)).Returns(@"
  • OK @@ -419,7 +419,7 @@ public void GetXbmcSeriesPath_special_characters() //var fakeUdpProvider = Mocker.GetMock(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(setResponseUrl, username, password)).Returns("OK"); fakeHttp.Setup(s => s.DownloadString(resetResponseUrl, username, password)).Returns(@"
  • OK @@ -468,7 +468,7 @@ public void UpdateWithHttp_Single() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult); fakeHttp.Setup(s => s.DownloadString(url, username, password)); @@ -494,7 +494,7 @@ public void UpdateWithHttp_All() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult); fakeHttp.Setup(s => s.DownloadString(url, username, password)); @@ -522,7 +522,7 @@ public void UpdateWithJsonBuiltIn_Single() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", "")))) .Returns(tvshows); @@ -555,7 +555,7 @@ public void UpdateWithJsonBuiltIn_All() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", "")))) .Returns(tvshows); @@ -588,7 +588,7 @@ public void UpdateWithJsonVideoLibraryScan_Single() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", "")))) .Returns(tvshows); @@ -620,7 +620,7 @@ public void UpdateWithJsonVideoLibraryScan_All() .With(s => s.Title = "30 Rock") .Build(); - var fakeHttp = Mocker.GetMock(); + var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", "")))) .Returns(tvshows); diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs index b9e87cb3a..4d7650960 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs @@ -22,19 +22,19 @@ public class GetSceneTvdbMappingsFixture : CoreTest { private void WithFailureJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files","Xem","Failure.txt")); } private void WithIdsJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files","Xem","Ids.txt")); } private void WithMappingsJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files","Xem","Mappings.txt")); } diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs index fa01b243b..bc82003a9 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs @@ -22,19 +22,19 @@ public class GetXemSeriesIdsFixture : CoreTest { private void WithFailureJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files", "Xem", "Failure.txt")); } private void WithIdsJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files", "Xem", "Ids.txt")); } private void WithMappingsJson() { - Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) + Mocker.GetMock().Setup(s => s.DownloadString(It.IsAny())) .Returns(ReadAllText("Files", "Xem", "Mappings.txt")); } diff --git a/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs b/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs index 7069fb466..428120be9 100644 --- a/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs +++ b/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs @@ -15,11 +15,11 @@ public interface IDailySeriesDataProxy public class DailySeriesDataProxy : IDailySeriesDataProxy { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly IConfigService _configService; private readonly Logger _logger; - public DailySeriesDataProxy(HttpProvider httpProvider, IConfigService configService, Logger logger) + public DailySeriesDataProxy(IHttpProvider httpProvider, IConfigService configService, Logger logger) { _httpProvider = httpProvider; _configService = configService; diff --git a/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs b/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs index 601175deb..757be3928 100644 --- a/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs +++ b/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs @@ -12,10 +12,10 @@ public interface ISceneMappingProxy public class SceneMappingProxy : ISceneMappingProxy { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly IConfigService _configService; - public SceneMappingProxy(HttpProvider httpProvider, IConfigService configService) + public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService) { _httpProvider = httpProvider; _configService = configService; diff --git a/NzbDrone.Core/Download/Clients/BlackholeProvider.cs b/NzbDrone.Core/Download/Clients/BlackholeProvider.cs index 0a2e1e138..a00f01410 100644 --- a/NzbDrone.Core/Download/Clients/BlackholeProvider.cs +++ b/NzbDrone.Core/Download/Clients/BlackholeProvider.cs @@ -12,13 +12,13 @@ namespace NzbDrone.Core.Download.Clients public class BlackholeProvider : IDownloadClient { private readonly IConfigService _configService; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly DiskProvider _diskProvider; private readonly UpgradeHistorySpecification _upgradeHistorySpecification; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public BlackholeProvider(IConfigService configService, HttpProvider httpProvider, + public BlackholeProvider(IConfigService configService, IHttpProvider httpProvider, DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification) { _configService = configService; diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs index d26315657..72129eaf1 100644 --- a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs +++ b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs @@ -13,14 +13,15 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { public class NzbgetProvider : IDownloadClient { - private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private readonly IConfigService _configService; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; + private readonly Logger _logger; - public NzbgetProvider(IConfigService configService, HttpProvider httpProvider) + public NzbgetProvider(IConfigService configService, IHttpProvider httpProvider, Logger logger) { _configService = configService; _httpProvider = httpProvider; + _logger = logger; } public NzbgetProvider() @@ -55,7 +56,7 @@ public virtual bool IsInQueue(IndexerParseResult newParseResult) catch (Exception ex) { - logger.WarnException("Unable to connect to Nzbget to check queue.", ex); + _logger.WarnException("Unable to connect to Nzbget to check queue.", ex); return false; } } @@ -73,20 +74,20 @@ public virtual bool DownloadNzb(string url, string title, bool recentlyAired) Params = new object[]{ title, cat, priority, false, url } }; - logger.Info("Adding report [{0}] to the queue.", title); + _logger.Info("Adding report [{0}] to the queue.", title); var response = PostCommand(JsonConvert.SerializeObject(command)); CheckForError(response); var success = JsonConvert.DeserializeObject(response).Result; - logger.Debug("Queue Response: [{0}]", success); + _logger.Debug("Queue Response: [{0}]", success); return true; } catch (WebException ex) { - logger.Error("Error communicating with Nzbget: " + ex.Message); + _logger.Error("Error communicating with Nzbget: " + ex.Message); } return false; @@ -145,7 +146,7 @@ public virtual string Test(string host, int port, string username, string passwo } catch(Exception ex) { - logger.DebugException("Failed to Test Nzbget", ex); + _logger.DebugException("Failed to Test Nzbget", ex); } return String.Empty; diff --git a/NzbDrone.Core/Download/Clients/PneumaticProvider.cs b/NzbDrone.Core/Download/Clients/PneumaticProvider.cs index 559d2d9d8..b621e0c66 100644 --- a/NzbDrone.Core/Download/Clients/PneumaticProvider.cs +++ b/NzbDrone.Core/Download/Clients/PneumaticProvider.cs @@ -15,12 +15,12 @@ namespace NzbDrone.Core.Download.Clients public class PneumaticProvider : IDownloadClient { private readonly IConfigService _configService; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly DiskProvider _diskProvider; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public PneumaticProvider(IConfigService configService, HttpProvider httpProvider, + public PneumaticProvider(IConfigService configService, IHttpProvider httpProvider, DiskProvider diskProvider) { _configService = configService; diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs index 2eb9855b5..a55820c7b 100644 --- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs +++ b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs @@ -19,9 +19,9 @@ public class SabProvider : IDownloadClient { private static readonly Logger logger = LogManager.GetCurrentClassLogger(); private readonly IConfigService _configService; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; - public SabProvider(IConfigService configService, HttpProvider httpProvider) + public SabProvider(IConfigService configService, IHttpProvider httpProvider) { _configService = configService; _httpProvider = httpProvider; diff --git a/NzbDrone.Core/ExternalNotification/PlexProvider.cs b/NzbDrone.Core/ExternalNotification/PlexProvider.cs index c2f21a1ce..3110c18b1 100644 --- a/NzbDrone.Core/ExternalNotification/PlexProvider.cs +++ b/NzbDrone.Core/ExternalNotification/PlexProvider.cs @@ -10,11 +10,11 @@ namespace NzbDrone.Core.ExternalNotification { public class PlexProvider { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly IConfigService _configService; private static readonly Logger logger = LogManager.GetCurrentClassLogger(); - public PlexProvider(HttpProvider httpProvider, IConfigService configService) + public PlexProvider(IHttpProvider httpProvider, IConfigService configService) { _httpProvider = httpProvider; _configService = configService; diff --git a/NzbDrone.Core/Indexers/IndexerFetchService.cs b/NzbDrone.Core/Indexers/IndexerFetchService.cs index 64d2960a6..a89c4ce87 100644 --- a/NzbDrone.Core/Indexers/IndexerFetchService.cs +++ b/NzbDrone.Core/Indexers/IndexerFetchService.cs @@ -21,10 +21,10 @@ public interface IFetchFeedFromIndexers public class FetchFeedService : IFetchFeedFromIndexers { private readonly Logger _logger; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; - protected FetchFeedService(HttpProvider httpProvider, Logger logger) + public FetchFeedService(IHttpProvider httpProvider, Logger logger) { _httpProvider = httpProvider; _logger = logger; diff --git a/NzbDrone.Core/Lifecycle/AppUpdateJob.cs b/NzbDrone.Core/Lifecycle/AppUpdateJob.cs index 0406ab6bf..ee94d5c0a 100644 --- a/NzbDrone.Core/Lifecycle/AppUpdateJob.cs +++ b/NzbDrone.Core/Lifecycle/AppUpdateJob.cs @@ -15,7 +15,7 @@ public class AppUpdateJob : IJob private readonly UpdateProvider _updateProvider; private readonly EnvironmentProvider _environmentProvider; private readonly DiskProvider _diskProvider; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly ProcessProvider _processProvider; private readonly ArchiveProvider _archiveProvider; private readonly ConfigFileProvider _configFileProvider; diff --git a/NzbDrone.Core/MediaCover/MediaCoverService.cs b/NzbDrone.Core/MediaCover/MediaCoverService.cs index d3d62e133..317894290 100644 --- a/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -12,13 +12,13 @@ public class MediaCoverService : IHandleAsync, IHandleAsync { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly DiskProvider _diskProvider; private readonly Logger _logger; private readonly string _coverRootFolder; - public MediaCoverService(HttpProvider httpProvider, DiskProvider diskProvider, EnvironmentProvider environmentProvider, Logger logger) + public MediaCoverService(IHttpProvider httpProvider, DiskProvider diskProvider, EnvironmentProvider environmentProvider, Logger logger) { _httpProvider = httpProvider; _diskProvider = diskProvider; diff --git a/NzbDrone.Core/Providers/UpdateProvider.cs b/NzbDrone.Core/Providers/UpdateProvider.cs index bf820937c..7fbe614c8 100644 --- a/NzbDrone.Core/Providers/UpdateProvider.cs +++ b/NzbDrone.Core/Providers/UpdateProvider.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Providers { public class UpdateProvider { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly IConfigService _configService; private readonly EnvironmentProvider _environmentProvider; @@ -26,7 +26,7 @@ public class UpdateProvider public const string DEFAULT_UPDATE_URL = @"http://update.nzbdrone.com/_release/"; - public UpdateProvider(HttpProvider httpProvider, IConfigService configService, + public UpdateProvider(IHttpProvider httpProvider, IConfigService configService, EnvironmentProvider environmentProvider, DiskProvider diskProvider) { _httpProvider = httpProvider; diff --git a/NzbDrone.Core/Providers/XbmcProvider.cs b/NzbDrone.Core/Providers/XbmcProvider.cs index a3210387d..861931549 100644 --- a/NzbDrone.Core/Providers/XbmcProvider.cs +++ b/NzbDrone.Core/Providers/XbmcProvider.cs @@ -18,10 +18,10 @@ public class XbmcProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private readonly IConfigService _configService; - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private readonly EventClientProvider _eventClientProvider; - public XbmcProvider(IConfigService configService, HttpProvider httpProvider, EventClientProvider eventClientProvider) + public XbmcProvider(IConfigService configService, IHttpProvider httpProvider, EventClientProvider eventClientProvider) { _configService = configService; _httpProvider = httpProvider; diff --git a/NzbDrone.Core/Providers/XemCommunicationProvider.cs b/NzbDrone.Core/Providers/XemCommunicationProvider.cs index f797527de..9d0645eff 100644 --- a/NzbDrone.Core/Providers/XemCommunicationProvider.cs +++ b/NzbDrone.Core/Providers/XemCommunicationProvider.cs @@ -12,13 +12,13 @@ namespace NzbDrone.Core.Providers { public class XemCommunicationProvider { - private readonly HttpProvider _httpProvider; + private readonly IHttpProvider _httpProvider; private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); private const string XEM_BASE_URL = "http://thexem.de/map/"; - public XemCommunicationProvider(HttpProvider httpProvider) + public XemCommunicationProvider(IHttpProvider httpProvider) { _httpProvider = httpProvider; }