|
|
@ -12,6 +12,7 @@ using System.Linq;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
|
|
|
namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -47,10 +48,15 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
|
|
|
private readonly string testdir = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Media");
|
|
|
|
private readonly string testdir = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Media");
|
|
|
|
private string copiedFile;
|
|
|
|
private string copiedFile;
|
|
|
|
private AudioTag testTags;
|
|
|
|
private AudioTag testTags;
|
|
|
|
|
|
|
|
private IDiskProvider _diskProvider;
|
|
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_diskProvider = Mocker.Resolve<IDiskProvider>("ActualDiskProvider");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.SetConstant<IDiskProvider>(_diskProvider);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
.Setup(x => x.WriteAudioTags)
|
|
|
|
.Setup(x => x.WriteAudioTags)
|
|
|
|
.Returns(WriteAudioTagsType.Sync);
|
|
|
|
.Returns(WriteAudioTagsType.Sync);
|
|
|
@ -344,6 +350,7 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
|
|
|
|
|
|
|
|
|
|
|
var file = Builder<TrackFile>.CreateNew()
|
|
|
|
var file = Builder<TrackFile>.CreateNew()
|
|
|
|
.With(x => x.Tracks = new List<Track> { tracks[0] })
|
|
|
|
.With(x => x.Tracks = new List<Track> { tracks[0] })
|
|
|
|
|
|
|
|
.With(x => x.Artist = artist)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
return file;
|
|
|
|
return file;
|
|
|
@ -357,5 +364,24 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
|
|
|
|
|
|
|
|
|
|
|
tag.MusicBrainzReleaseCountry.Should().BeNull();
|
|
|
|
tag.MusicBrainzReleaseCountry.Should().BeNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("nin.mp3")]
|
|
|
|
|
|
|
|
public void write_tags_should_update_trackfile_size_and_modified(string filename)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Mocker.GetMock<IConfigService>()
|
|
|
|
|
|
|
|
.Setup(x => x.ScrubAudioTags)
|
|
|
|
|
|
|
|
.Returns(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GivenFileCopy(filename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var file = GivenPopulatedTrackfile();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file.Path = copiedFile;
|
|
|
|
|
|
|
|
Subject.WriteTags(file, false, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fileInfo = _diskProvider.GetFileInfo(file.Path);
|
|
|
|
|
|
|
|
file.Modified.Should().Be(fileInfo.LastWriteTimeUtc);
|
|
|
|
|
|
|
|
file.Size.Should().Be(fileInfo.Length);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|