1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Verify disk scan won't scan if root folder doesn't exist

This commit is contained in:
Mark McDowall 2014-07-24 18:02:47 -07:00
parent 638c149b62
commit 08b2e293d3
4 changed files with 48 additions and 5 deletions

View File

@ -0,0 +1,44 @@
using System;
using System.IO;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
{
[TestFixture]
public class ScanFixture : CoreTest<DiskScanService>
{
private Series _series;
[SetUp]
public void Setup()
{
_series = Builder<Series>.CreateNew()
.With(s => s.Path = @"C:\Test\TV\Series")
.Build();
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetParentFolder(It.IsAny<String>()))
.Returns((String path) => Directory.GetParent(path).FullName);
}
[Test]
public void should_not_scan_if_series_root_folder_does_not_exist()
{
Subject.Scan(_series);
ExceptionVerification.ExpectedWarns(1);
Mocker.GetMock<ICommandExecutor>()
.Verify(v => v.PublishCommand(It.IsAny<CleanMediaFileDb>()), Times.Never());
}
}
}

View File

@ -155,6 +155,7 @@
<Compile Include="JobTests\TestJobs.cs" />
<Compile Include="MediaCoverTests\CoverExistsSpecificationFixture.cs" />
<Compile Include="MediaCoverTests\MediaCoverServiceFixture.cs" />
<Compile Include="MediaFiles\DiskScanServiceTests\ScanFixture.cs" />
<Compile Include="MediaFiles\EpisodeFileMovingServiceTests\MoveEpisodeFileFixture.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecificationFixture.cs" />
<Compile Include="MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecificationFixture.cs" />

View File

@ -168,9 +168,9 @@ public string UrlBase
{
get
{
var urlBase = GetValue("UrlBase", "");
var urlBase = GetValue("UrlBase", "").Trim('/');
if (String.IsNullOrEmpty(urlBase))
if (urlBase.IsNullOrWhiteSpace())
{
return urlBase;
}

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Linq;
using NLog;