diff --git a/NzbDrone.Core.Test/MediaFileTests/EpisodeImportTests/FreeSpaceSpecificationFixture.cs b/NzbDrone.Core.Test/MediaFileTests/EpisodeImportTests/FreeSpaceSpecificationFixture.cs index 47804bde0..ec0f60624 100644 --- a/NzbDrone.Core.Test/MediaFileTests/EpisodeImportTests/FreeSpaceSpecificationFixture.cs +++ b/NzbDrone.Core.Test/MediaFileTests/EpisodeImportTests/FreeSpaceSpecificationFixture.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.MediaFileTests.EpisodeImportTests _localEpisode.Size = size; } - private void GivenFreeSpace(long size) + private void GivenFreeSpace(long? size) { Mocker.GetMock() .Setup(s => s.GetAvailableSpace(It.IsAny())) @@ -98,5 +98,30 @@ namespace NzbDrone.Core.Test.MediaFileTests.EpisodeImportTests Mocker.GetMock() .Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once()); } + + + [Test] + public void should_pass_if_free_space_is_null() + { + GivenFileSize(100.Megabytes()); + GivenFreeSpace(null); + + Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue(); + } + + + + [Test] + public void should_pass_if_exception_is_thrown() + { + GivenFileSize(100.Megabytes()); + + Mocker.GetMock() + .Setup(s => s.GetAvailableSpace(It.IsAny())) + .Throws(new TestException()); + + Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue(); + ExceptionVerification.ExpectedWarns(1); + } } } diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs b/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs index 9c499d8fb..2d21b7500 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs @@ -31,14 +31,13 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications _logger.Warn("Not enough free space to import: {0}", localEpisode); return false; } - - return true; } catch (Exception ex) { _logger.ErrorException("Unable to check free disk space while importing: " + localEpisode.Path, ex); - throw; } + + return true; } } }