From 861026f743506c764f0a2d93659c841303ce202a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 2 Jul 2011 16:45:29 -0700 Subject: [PATCH] Fixed some petapoco issue with insert. --- IISExpress/AppServer/applicationhost.config | 2 +- NzbDrone.Core.Test/RootDirProviderTest.cs | 29 ----------------- NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs | 2 +- NzbDrone.Core/Providers/RootDirProvider.cs | 7 ---- .../Controllers/SettingsController.cs | 32 +------------------ NzbDrone/app.config | 2 +- 6 files changed, 4 insertions(+), 70 deletions(-) diff --git a/IISExpress/AppServer/applicationhost.config b/IISExpress/AppServer/applicationhost.config index 617c6762a..458aeedbb 100644 --- a/IISExpress/AppServer/applicationhost.config +++ b/IISExpress/AppServer/applicationhost.config @@ -145,7 +145,7 @@ - + diff --git a/NzbDrone.Core.Test/RootDirProviderTest.cs b/NzbDrone.Core.Test/RootDirProviderTest.cs index b529b1fde..9d2efce7a 100644 --- a/NzbDrone.Core.Test/RootDirProviderTest.cs +++ b/NzbDrone.Core.Test/RootDirProviderTest.cs @@ -60,26 +60,6 @@ public void AddRootDir(string path) } - [TestCase("D:\\TV Shows\\")] - [TestCase("//server//folder")] - public void UpdateRootDir(string newPath) - { - //Setup - var mocker = new AutoMoqer(); - mocker.SetConstant(MockLib.GetEmptyDatabase()); - - - //Act - var rootDirProvider = mocker.Resolve(); - rootDirProvider.Add(new RootDir { Path = @"C:\TV" }); - rootDirProvider.Update(new RootDir { Id = 1, Path = newPath }); - - //Assert - var rootDirs = rootDirProvider.GetAll(); - rootDirs.Should().HaveCount(1); - newPath.Should().Be(rootDirs.First().Path); - } - [Test] public void RemoveRootDir() { @@ -152,14 +132,5 @@ public void invalid_folder_path_throws_on_add(string path) mocker.Resolve().Add(new RootDir { Id = 0, Path = path }); } - [TestCase("")] - [TestCase(null)] - [TestCase("BAD PATH")] - [ExpectedException(typeof(ArgumentException))] - public void invalid_folder_path_throws_on_update(string path) - { - var mocker = new AutoMoqer(); - mocker.Resolve().Update(new RootDir { Id = 2, Path = path }); - } } } \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs index d03718ec8..0e00ac002 100644 --- a/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs +++ b/NzbDrone.Core/Datastore/PetaPoco/PetaPoco.cs @@ -329,7 +329,7 @@ enum DBType Oracle, SQLite } - DBType _dbType = DBType.SqlServer; + DBType _dbType = DBType.SqlServerCE; // Common initialization private void CommonConstruct() diff --git a/NzbDrone.Core/Providers/RootDirProvider.cs b/NzbDrone.Core/Providers/RootDirProvider.cs index 408033174..fcd574f05 100644 --- a/NzbDrone.Core/Providers/RootDirProvider.cs +++ b/NzbDrone.Core/Providers/RootDirProvider.cs @@ -42,13 +42,6 @@ public virtual void Remove(int rootDirId) _database.Delete(rootDirId); } - public virtual void Update(RootDir rootDir) - { - ValidatePath(rootDir); - - _database.Update(rootDir); - } - private static void ValidatePath(RootDir rootDir) { if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path)) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index c5d627648..74a7a8d21 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -269,37 +269,7 @@ public JsonResult AutoConfigureSab() } } - [HttpPost] - public ActionResult SaveGeneral(SettingsModel data) - { - var basicNotification = new BasicNotification(); - basicNotification.Type = BasicNotificationType.Info; - basicNotification.AutoDismiss = true; - - try - { - foreach (var dir in data.Directories) - { - _rootDirProvider.Update(dir); - } - } - catch (Exception ex) - { - Logger.Debug("Failed to save Root Dirs"); - Logger.DebugException(ex.Message, ex); - - basicNotification.Title = SETTINGS_FAILED; - _notificationProvider.Register(basicNotification); - return Content(SETTINGS_FAILED); - } - - - basicNotification.Title = SETTINGS_SAVED; - _notificationProvider.Register(basicNotification); - - return Content(SETTINGS_SAVED); - } - + [HttpPost] public ActionResult SaveIndexers(IndexerSettingsModel data) { diff --git a/NzbDrone/app.config b/NzbDrone/app.config index 19dd15844..81d395705 100644 --- a/NzbDrone/app.config +++ b/NzbDrone/app.config @@ -4,6 +4,6 @@ - + \ No newline at end of file