Fixed some petapoco issue with insert.

This commit is contained in:
kay.one 2011-07-02 16:45:29 -07:00
parent 5a4e8330b2
commit 861026f743
6 changed files with 4 additions and 70 deletions

View File

@ -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" />

View File

@ -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 });
}
}
}

View File

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

View File

@ -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))

View File

@ -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)
{

View File

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