mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
New: Add Medium FileNameBuilder Unit Tests
This commit is contained in:
parent
61cf1ccb7c
commit
2992ea60d8
1 changed files with 33 additions and 7 deletions
|
@ -18,6 +18,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
{
|
{
|
||||||
private Artist _artist;
|
private Artist _artist;
|
||||||
private Album _album;
|
private Album _album;
|
||||||
|
private Medium _medium;
|
||||||
private AlbumRelease _release;
|
private AlbumRelease _release;
|
||||||
private Track _track1;
|
private Track _track1;
|
||||||
private TrackFile _trackFile;
|
private TrackFile _trackFile;
|
||||||
|
@ -35,6 +36,17 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
_medium = Builder<Medium>
|
||||||
|
.CreateNew()
|
||||||
|
.With(m => m.Number = 3)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
_release = Builder<AlbumRelease>
|
||||||
|
.CreateNew()
|
||||||
|
.With(s => s.Media = new List<Medium> { _medium })
|
||||||
|
.With(s => s.Monitored = true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
_album = Builder<Album>
|
_album = Builder<Album>
|
||||||
.CreateNew()
|
.CreateNew()
|
||||||
.With(s => s.Title = "Hybrid Theory")
|
.With(s => s.Title = "Hybrid Theory")
|
||||||
|
@ -42,11 +54,6 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.With(s => s.Disambiguation = "The Best Album")
|
.With(s => s.Disambiguation = "The Best Album")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_release = Builder<AlbumRelease>
|
|
||||||
.CreateNew()
|
|
||||||
.With(s => s.Media = new List<Medium> { new Medium { Number = 1 } })
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
|
|
||||||
_namingConfig = NamingConfig.Default;
|
_namingConfig = NamingConfig.Default;
|
||||||
_namingConfig.RenameTracks = true;
|
_namingConfig.RenameTracks = true;
|
||||||
|
@ -59,6 +66,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.With(e => e.Title = "City Sushi")
|
.With(e => e.Title = "City Sushi")
|
||||||
.With(e => e.AbsoluteTrackNumber = 6)
|
.With(e => e.AbsoluteTrackNumber = 6)
|
||||||
.With(e => e.AlbumRelease = _release)
|
.With(e => e.AlbumRelease = _release)
|
||||||
|
.With(e => e.MediumNumber = _medium.Number)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_trackFile = new TrackFile { Quality = new QualityModel(Quality.MP3_256), ReleaseGroup = "LidarrTest" };
|
_trackFile = new TrackFile { Quality = new QualityModel(Quality.MP3_256), ReleaseGroup = "LidarrTest" };
|
||||||
|
@ -289,6 +297,24 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.Should().Be("01");
|
.Should().Be("01");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_replace_medium_number_with_single_digit()
|
||||||
|
{
|
||||||
|
_namingConfig.StandardTrackFormat = "{medium}";
|
||||||
|
|
||||||
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
|
.Should().Be("3");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_replace_medium00_number_with_two_digits()
|
||||||
|
{
|
||||||
|
_namingConfig.StandardTrackFormat = "{medium:00}";
|
||||||
|
|
||||||
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
|
.Should().Be("03");
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_replace_quality_title()
|
public void should_replace_quality_title()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue