1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixes after rebase

This commit is contained in:
Mark McDowall 2014-01-26 16:09:44 -08:00
parent 409e1cca94
commit e9db0fc14a
18 changed files with 20 additions and 63 deletions

View File

@ -50,7 +50,6 @@ public void matching_fields(Type modelType, Type resourceType)
MappingValidation.ValidateMapping(modelType, resourceType);
}
[Test]
public void should_map_lay_loaded_values_should_not_be_inject_if_not_loaded()
{

View File

@ -59,5 +59,7 @@ public Int32 SeasonCount
public String ImdbId { get; set; }
public String TitleSlug { get; set; }
public String RootFolderPath { get; set; }
public String Certification { get; set; }
public List<String> Genres { get; set; }
}
}

View File

@ -5,7 +5,6 @@
namespace NzbDrone.Common.Test.DiskProviderTests
{
public class IsParentFixtureBase<TSubject> : TestBase<TSubject> where TSubject : class, IDiskProvider
public class IsParentFixture : TestBase
{
private string _parent = @"C:\Test".AsOsAgnostic();
@ -15,7 +14,7 @@ public void should_return_false_when_not_a_child()
{
var path = @"C:\Another Folder".AsOsAgnostic();
DiskProvider.IsParent(_parent, path).Should().BeFalse();
DiskProviderBase.IsParent(_parent, path).Should().BeFalse();
}
[Test]
@ -23,7 +22,7 @@ public void should_return_true_when_folder_is_parent_of_another_folder()
{
var path = @"C:\Test\TV".AsOsAgnostic();
DiskProvider.IsParent(_parent, path).Should().BeTrue();
DiskProviderBase.IsParent(_parent, path).Should().BeTrue();
}
[Test]
@ -31,7 +30,7 @@ public void should_return_true_when_folder_is_parent_of_a_file()
{
var path = @"C:\Test\30.Rock.S01E01.Pilot.avi".AsOsAgnostic();
DiskProvider.IsParent(_parent, path).Should().BeTrue();
DiskProviderBase.IsParent(_parent, path).Should().BeTrue();
}
}
}

View File

@ -12,7 +12,6 @@ namespace NzbDrone.Common.Disk
{
public abstract class DiskProviderBase : IDiskProvider
{
void CopyFile(string source, string destination, bool overwrite = false);
enum TransferAction
{
Copy,
@ -26,7 +25,6 @@ enum TransferAction
public abstract void SetPermissions(string path, string mask, string user, string group);
public abstract long? GetTotalSize(string path);
//TODO: this needs tests
public static string GetRelativePath(string parentPath, string childPath)
{
if (!IsParent(parentPath, childPath))
@ -272,11 +270,6 @@ public void MoveFile(string source, string destination)
File.Move(source, destination);
}
public void CopyFile(string source, string destination, bool overwrite = false)
{
File.Copy(source, destination, overwrite);
}
public void DeleteFolder(string path, bool recursive)
{
Ensure.That(path, () => path).IsValidPath();

View File

@ -37,7 +37,6 @@ public interface IDiskProvider
string GetPathRoot(string path);
string GetParentFolder(string path);
void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType);
bool IsParent(string parentPath, string childPath);
void SetFolderWriteTime(string path, DateTime time);
FileAttributes GetFileAttributes(string path);
void EmptyFolder(string path);

View File

@ -1,5 +1,4 @@
using System.Linq;
using FizzWare.NBuilder;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Housekeeping.Housekeepers;

View File

@ -122,15 +122,6 @@ public void should_not_move_existing_files()
Times.Never());
}
[Test]
public void should_not_trigger_EpisodeImportedEvent_for_existing_files()
{
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() });
Mocker.GetMock<IEventAggregator>()
.Verify(v => v.PublishEvent(It.IsAny<EpisodeImportedEvent>()), Times.Never());
}
[Test]
public void should_import_larger_files_first()
{

View File

@ -48,7 +48,7 @@ public void Execute(CleanMediaFileDb message)
continue;
}
if (!DiskProvider.IsParent(series.Path, episodeFile.Path))
if (!DiskProviderBase.IsParent(series.Path, episodeFile.Path))
{
_logger.Trace("File [{0}] does not belong to this series, removing from db", episodeFile.Path);
_mediaFileService.Delete(episodeFile);

View File

@ -7,6 +7,7 @@
using System.Xml.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Metadata.Files;
using NzbDrone.Core.Tv;

View File

@ -8,6 +8,7 @@
using System.Xml.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Messaging.Events;
@ -91,7 +92,7 @@ public override void AfterRename(Series series)
{
var metadataFiles = episodeFilesMetadata.Where(m => m.EpisodeFileId == episodeFile.Id).ToList();
var episodeFilenameWithoutExtension =
Path.GetFileNameWithoutExtension(DiskProvider.GetRelativePath(series.Path, episodeFile.Path));
Path.GetFileNameWithoutExtension(DiskProviderBase.GetRelativePath(series.Path, episodeFile.Path));
foreach (var metadataFile in metadataFiles)
{
@ -122,7 +123,7 @@ public override MetadataFile FindMetadataFile(Series series, string path)
{
SeriesId = series.Id,
Consumer = GetType().Name,
RelativePath = DiskProvider.GetRelativePath(series.Path, path)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, path)
};
if (SeriesImagesRegex.IsMatch(filename))
@ -235,7 +236,7 @@ private void WriteTvShowNfo(Series series, List<MetadataFile> existingMetadataFi
SeriesId = series.Id,
Consumer = GetType().Name,
Type = MetadataType.SeriesMetadata,
RelativePath = DiskProvider.GetRelativePath(series.Path, path)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, path)
};
_eventAggregator.PublishEvent(new MetadataFileUpdated(metadata));
@ -264,7 +265,7 @@ private void WriteSeriesImages(Series series, List<MetadataFile> existingMetadat
SeriesId = series.Id,
Consumer = GetType().Name,
Type = MetadataType.SeriesImage,
RelativePath = DiskProvider.GetRelativePath(series.Path, destination)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, destination)
};
_eventAggregator.PublishEvent(new MetadataFileUpdated(metadata));
@ -296,7 +297,7 @@ private void WriteSeasonImages(Series series, List<MetadataFile> existingMetadat
SeasonNumber = season.SeasonNumber,
Consumer = GetType().Name,
Type = MetadataType.SeriesMetadata,
RelativePath = DiskProvider.GetRelativePath(series.Path, path)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, path)
};
_eventAggregator.PublishEvent(new MetadataFileUpdated(metadata));
@ -355,7 +356,7 @@ private void WriteEpisodeNfo(Series series, EpisodeFile episodeFile)
EpisodeFileId = episodeFile.Id,
Consumer = GetType().Name,
Type = MetadataType.SeasonImage,
RelativePath = DiskProvider.GetRelativePath(series.Path, filename)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, filename)
};
_eventAggregator.PublishEvent(new MetadataFileUpdated(metadata));
@ -375,7 +376,7 @@ private void WriteEpisodeImages(Series series, EpisodeFile episodeFile)
EpisodeFileId = episodeFile.Id,
Consumer = GetType().Name,
Type = MetadataType.SeasonImage,
RelativePath = DiskProvider.GetRelativePath(series.Path, filename)
RelativePath = DiskProviderBase.GetRelativePath(series.Path, filename)
};
_eventAggregator.PublishEvent(new MetadataFileUpdated(metadata));

View File

@ -3,6 +3,7 @@
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Metadata.Files;

View File

@ -4,6 +4,7 @@
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Tv;

View File

@ -3,6 +3,7 @@
using System.Net;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Metadata.Files;
using NzbDrone.Core.ThingiProvider;

View File

@ -64,7 +64,7 @@ public LocalEpisode GetEpisodes(string filename, Series series, bool sceneSource
Episodes = episodes,
Path = filename,
ParsedEpisodeInfo = parsedEpisodeInfo,
ExistingFile = DiskProvider.IsParent(series.Path, filename)
ExistingFile = DiskProviderBase.IsParent(series.Path, filename)
};
}

View File

@ -1,14 +0,0 @@
using NUnit.Framework;
using NzbDrone.Common.Test.DiskProviderTests;
namespace NzbDrone.Mono.Test.DiskProviderTests
{
[TestFixture]
public class IsParentFixtureFixture : IsParentFixtureBase<DiskProvider>
{
public IsParentFixtureFixture()
{
LinuxOnly();
}
}
}

View File

@ -68,7 +68,6 @@
<ItemGroup>
<Compile Include="DiskProviderTests\DiskProviderFixture.cs" />
<Compile Include="DiskProviderTests\FreeSpaceFixture.cs" />
<Compile Include="DiskProviderTests\IsParentFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceFactoryFixture.cs" />
</ItemGroup>

View File

@ -1,14 +0,0 @@
using NUnit.Framework;
using NzbDrone.Common.Test.DiskProviderTests;
namespace NzbDrone.Windows.Test.DiskProviderTests
{
[TestFixture]
public class IsParentFixtureFixture : IsParentFixtureBase<DiskProvider>
{
public IsParentFixtureFixture()
{
WindowsOnly();
}
}
}

View File

@ -67,7 +67,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DiskProviderTests\IsParentFixture.cs" />
<Compile Include="DiskProviderTests\DiskProviderFixture.cs" />
<Compile Include="DiskProviderTests\FreeSpaceFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />