diff --git a/NzbDrone.Core.Test/DbConfigControllerTest.cs b/NzbDrone.Core.Test/DbConfigControllerTest.cs index 88ac644af..55d3f992c 100644 --- a/NzbDrone.Core.Test/DbConfigControllerTest.cs +++ b/NzbDrone.Core.Test/DbConfigControllerTest.cs @@ -6,7 +6,7 @@ using log4net; using MbUnit.Framework; using MbUnit.Framework.ContractVerifiers; using Moq; -using NzbDrone.Core.Controllers; +using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using SubSonic.Repository; @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test var repo = new Mock(); var config = new Config { Key = key, Value = value }; repo.Setup(r => r.Single(key)).Returns(config); - var target = new DbConfigController(new Mock().Object, repo.Object); + var target = new ConfigProvider(new Mock().Object, repo.Object); //Act target.SetValue(key, value); @@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test //Arrange var repo = new Mock(); repo.Setup(r => r.Single(It.IsAny())).Returns(null).Verifiable(); - var target = new DbConfigController(new Mock().Object, repo.Object); + var target = new ConfigProvider(new Mock().Object, repo.Object); //Act target.SetValue(key, value); diff --git a/NzbDrone.Core.Test/MockLib.cs b/NzbDrone.Core.Test/MockLib.cs index 5a1dad397..b7b7d7a0d 100644 --- a/NzbDrone.Core.Test/MockLib.cs +++ b/NzbDrone.Core.Test/MockLib.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Moq; -using NzbDrone.Core.Controllers; +using NzbDrone.Core.Providers; namespace NzbDrone.Core.Test { @@ -18,21 +18,21 @@ namespace NzbDrone.Core.Test } - public static IConfigController StandardConfig + public static IConfigProvider StandardConfig { get { - var mock = new Mock(); + var mock = new Mock(); mock.SetupGet(c => c.SeriesRoot).Returns("C:\\"); return mock.Object; } } - public static IDiskController StandardDisk + public static IDiskProvider StandardDisk { get { - var mock = new Mock(); + var mock = new Mock(); mock.Setup(c => c.GetDirectories(It.IsAny())).Returns(StandardSeries); mock.Setup(c => c.Exists(It.Is(d => StandardSeries.Contains(d)))).Returns(true); return mock.Object; diff --git a/NzbDrone.Core.Test/SabControllerTest.cs b/NzbDrone.Core.Test/SabControllerTest.cs index 0325fa6a7..6727e01ce 100644 --- a/NzbDrone.Core.Test/SabControllerTest.cs +++ b/NzbDrone.Core.Test/SabControllerTest.cs @@ -7,8 +7,8 @@ using log4net; using MbUnit.Framework; using MbUnit.Framework.ContractVerifiers; using Moq; +using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; -using NzbDrone.Core.Controllers; using SubSonic.Repository; namespace NzbDrone.Core.Test @@ -26,17 +26,17 @@ namespace NzbDrone.Core.Test string password = "pass"; string priority = "0"; - var config = new Mock(); + var config = new Mock(); config.Setup(c => c.GetValue("SabnzbdInfo", String.Empty, false)).Returns(sabnzbdInfo); config.Setup(c => c.GetValue("ApiKey", String.Empty, false)).Returns(apikey); config.Setup(c => c.GetValue("Username", String.Empty, false)).Returns(username); config.Setup(c => c.GetValue("Password", String.Empty, false)).Returns(password); config.Setup(c => c.GetValue("Priority", String.Empty, false)).Returns(priority); - var http = new Mock(); + var http = new Mock(); http.Setup(s => s.GetRequest("http://192.168.5.55:2222/sabnzbd/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")).Returns("ok"); - var target = new SabController(config.Object, new Mock().Object, http.Object); + var target = new SabProvider(config.Object, new Mock().Object, http.Object); ItemInfo nzb = new ItemInfo(); nzb.Link = new Uri("http://www.nzbclub.com/nzb_download.aspx?mid=1950232"); @@ -59,17 +59,17 @@ namespace NzbDrone.Core.Test string password = "pass"; string priority = "0"; - var config = new Mock(); + var config = new Mock(); config.Setup(c => c.GetValue("SabnzbdInfo", String.Empty, false)).Returns(sabnzbdInfo); config.Setup(c => c.GetValue("ApiKey", String.Empty, false)).Returns(apikey); config.Setup(c => c.GetValue("Username", String.Empty, false)).Returns(username); config.Setup(c => c.GetValue("Password", String.Empty, false)).Returns(password); config.Setup(c => c.GetValue("Priority", String.Empty, false)).Returns(priority); - var http = new Mock(); + var http = new Mock(); http.Setup(s => s.GetRequest("http://192.168.5.55:2222/sabnzbd/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&cat=tv&nzbname=This+is+an+Nzb&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")).Returns("error"); - var target = new SabController(config.Object, new Mock().Object, http.Object); + var target = new SabProvider(config.Object, new Mock().Object, http.Object); ItemInfo nzb = new ItemInfo(); nzb.Link = new Uri("http://www.nzbclub.com/nzb_download.aspx?mid=1950232"); @@ -92,21 +92,21 @@ namespace NzbDrone.Core.Test string password = "pass"; string priority = "0"; - var config = new Mock(); + var config = new Mock(); config.Setup(c => c.GetValue("SabnzbdInfo", String.Empty, false)).Returns(sabnzbdInfo); config.Setup(c => c.GetValue("ApiKey", String.Empty, false)).Returns(apikey); config.Setup(c => c.GetValue("Username", String.Empty, false)).Returns(username); config.Setup(c => c.GetValue("Password", String.Empty, false)).Returns(password); config.Setup(c => c.GetValue("Priority", String.Empty, false)).Returns(priority); - var http = new Mock(); + var http = new Mock(); http.Setup( s => s.GetRequest( "http://192.168.5.55:2222/sabnzbd/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(new StreamReader(@".\Files\Queue.xml").ReadToEnd()); - var target = new SabController(config.Object, new Mock().Object, http.Object); + var target = new SabProvider(config.Object, new Mock().Object, http.Object); Episode episode = new Episode(); FeedItem item = new FeedItem(); @@ -130,21 +130,21 @@ namespace NzbDrone.Core.Test string password = "pass"; string priority = "0"; - var config = new Mock(); + var config = new Mock(); config.Setup(c => c.GetValue("SabnzbdInfo", String.Empty, false)).Returns(sabnzbdInfo); config.Setup(c => c.GetValue("ApiKey", String.Empty, false)).Returns(apikey); config.Setup(c => c.GetValue("Username", String.Empty, false)).Returns(username); config.Setup(c => c.GetValue("Password", String.Empty, false)).Returns(password); config.Setup(c => c.GetValue("Priority", String.Empty, false)).Returns(priority); - var http = new Mock(); + var http = new Mock(); http.Setup( s => s.GetRequest( "http://192.168.5.55:2222/sabnzbd/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(new StreamReader(@".\Files\QueueEmpty.xml").ReadToEnd()); - var target = new SabController(config.Object, new Mock().Object, http.Object); + var target = new SabProvider(config.Object, new Mock().Object, http.Object); Episode episode = new Episode(); FeedItem item = new FeedItem(); @@ -168,21 +168,21 @@ namespace NzbDrone.Core.Test string password = "pass"; string priority = "0"; - var config = new Mock(); + var config = new Mock(); config.Setup(c => c.GetValue("SabnzbdInfo", String.Empty, false)).Returns(sabnzbdInfo); config.Setup(c => c.GetValue("ApiKey", String.Empty, false)).Returns(apikey); config.Setup(c => c.GetValue("Username", String.Empty, false)).Returns(username); config.Setup(c => c.GetValue("Password", String.Empty, false)).Returns(password); config.Setup(c => c.GetValue("Priority", String.Empty, false)).Returns(priority); - var http = new Mock(); + var http = new Mock(); http.Setup( s => s.GetRequest( "http://192.168.5.55:2222/sabnzbd/api?mode=queue&output=xml&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(new StreamReader(@".\Files\QueueError.xml").ReadToEnd()); - var target = new SabController(config.Object, new Mock().Object, http.Object); + var target = new SabProvider(config.Object, new Mock().Object, http.Object); Episode episode = new Episode(); FeedItem item = new FeedItem(); diff --git a/NzbDrone.Core.Test/SeriesTest.cs b/NzbDrone.Core.Test/SeriesTest.cs index 8ac0db330..8d374c16e 100644 --- a/NzbDrone.Core.Test/SeriesTest.cs +++ b/NzbDrone.Core.Test/SeriesTest.cs @@ -10,7 +10,7 @@ using MbUnit.Framework.ContractVerifiers; using Moq; using Ninject; using Ninject.Moq; -using NzbDrone.Core.Controllers; +using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using SubSonic.Repository; using TvdbLib.Data; @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test //Arrange var moqData = new Mock(); - var moqTvdb = new Mock(); + var moqTvdb = new Mock(); //setup db to return a fake series Series fakeSeries = Builder.CreateNew() @@ -52,14 +52,14 @@ namespace NzbDrone.Core.Test var kernel = new MockingKernel(); kernel.Bind().ToConstant(moqData.Object); - kernel.Bind().ToConstant(moqTvdb.Object); - kernel.Bind().ToConstant(MockLib.StandardConfig); - kernel.Bind().ToConstant(MockLib.StandardDisk); - kernel.Bind().To(); + kernel.Bind().ToConstant(moqTvdb.Object); + kernel.Bind().ToConstant(MockLib.StandardConfig); + kernel.Bind().ToConstant(MockLib.StandardDisk); + kernel.Bind().To(); //Act - var seriesController = kernel.Get(); + var seriesController = kernel.Get(); seriesController.SyncSeriesWithDisk(); //Assert diff --git a/NzbDrone.Core.Test/TvDbControllerTest.cs b/NzbDrone.Core.Test/TvDbControllerTest.cs index cda749b55..e35b19cbc 100644 --- a/NzbDrone.Core.Test/TvDbControllerTest.cs +++ b/NzbDrone.Core.Test/TvDbControllerTest.cs @@ -4,7 +4,7 @@ using System.Text; using Gallio.Framework; using MbUnit.Framework; using MbUnit.Framework.ContractVerifiers; -using NzbDrone.Core.Controllers; +using NzbDrone.Core.Providers; namespace NzbDrone.Core.Test { @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test [Ignore("Have to find a way to mock app path for tests.")] public void TestSearch(string title) { - var tvCont =new TvDbController(); + var tvCont =new TvDbProvider(); var result = tvCont.SearchSeries(title); Assert.AreNotEqual(0, result.Count); diff --git a/NzbDrone.Core/Controllers/IConfigController.cs b/NzbDrone.Core/Controllers/IConfigController.cs deleted file mode 100644 index e76ef216b..000000000 --- a/NzbDrone.Core/Controllers/IConfigController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace NzbDrone.Core.Controllers -{ - public interface IConfigController - { - String SeriesRoot - { - get; - - set; - } - - string GetValue(string key, object defaultValue, bool makePermanent); - void SetValue(string key, string value); - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Controllers/IHttpController.cs b/NzbDrone.Core/Controllers/IHttpController.cs deleted file mode 100644 index c1fa8fd5c..000000000 --- a/NzbDrone.Core/Controllers/IHttpController.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Controllers -{ - public interface IHttpController - { - string GetRequest(string request); - } -} diff --git a/NzbDrone.Core/Main.cs b/NzbDrone.Core/Main.cs index 5d9aa8a57..f05461cd9 100644 --- a/NzbDrone.Core/Main.cs +++ b/NzbDrone.Core/Main.cs @@ -3,7 +3,7 @@ using System.IO; using System.Web; using log4net; using Ninject; -using NzbDrone.Core.Controllers; +using NzbDrone.Core.Providers; using SubSonic.DataProviders; using SubSonic.Repository; @@ -17,10 +17,10 @@ namespace NzbDrone.Core string connectionString = String.Format("Data Source={0};Version=3;", Path.Combine(AppPath, "nzbdrone.db")); var provider = ProviderFactory.GetProvider(connectionString, "System.Data.SQLite"); - kernel.Bind().To(); - kernel.Bind().To(); - kernel.Bind().To(); - kernel.Bind().To(); + kernel.Bind().To(); + kernel.Bind().To(); + kernel.Bind().To(); + kernel.Bind().To(); kernel.Bind().ToMethod(c => LogManager.GetLogger("logger-name")); kernel.Bind().ToMethod(c => new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations)); } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 41823a5cd..4e0f4a0e4 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -135,13 +135,13 @@ - - - - - - - + + + + + + + @@ -151,11 +151,11 @@ - - - - - + + + + + @@ -202,6 +202,7 @@ +