Fixed some petapoco issue with insert.

pull/4/head
kay.one 13 years ago
parent 5a4e8330b2
commit 861026f743

@ -145,7 +145,7 @@
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8980:" />
<binding protocol="http" bindingInformation="*:8989:" />
</bindings>
</site>
<applicationDefaults applicationPool="IISExpressAppPool" />

@ -60,26 +60,6 @@ namespace NzbDrone.Core.Test
}
[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>();
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 @@ namespace NzbDrone.Core.Test
mocker.Resolve<RootDirProvider>().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<RootDirProvider>().Update(new RootDir { Id = 2, Path = path });
}
}
}

@ -329,7 +329,7 @@ namespace PetaPoco
Oracle,
SQLite
}
DBType _dbType = DBType.SqlServer;
DBType _dbType = DBType.SqlServerCE;
// Common initialization
private void CommonConstruct()

@ -42,13 +42,6 @@ namespace NzbDrone.Core.Providers
_database.Delete<RootDir>(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))

@ -269,37 +269,7 @@ namespace NzbDrone.Web.Controllers
}
}
[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)
{

@ -4,6 +4,6 @@
<supportedRuntime version="v4.0" />
</startup>
<appSettings>
<add key="port" value="8980" />
<add key="port" value="8989" />
</appSettings>
</configuration>
Loading…
Cancel
Save