mirror of
https://github.com/Radarr/Radarr
synced 2024-12-28 10:51:48 +00:00
Fixed UpdateMediaInfoService tests
This commit is contained in:
parent
db4b0de5e2
commit
459715b9b4
1 changed files with 29 additions and 3 deletions
|
@ -55,7 +55,33 @@ private void GivenFailedScan(string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_get_for_existing_episodefile_on_after_series_scan()
|
public void should_skip_up_to_date_media_info()
|
||||||
|
{
|
||||||
|
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(3)
|
||||||
|
.All()
|
||||||
|
.With(v => v.RelativePath = "media.mkv")
|
||||||
|
.TheFirst(1)
|
||||||
|
.With(v => v.MediaInfo = new MediaInfoModel { SchemaRevision = 2 })
|
||||||
|
.BuildList();
|
||||||
|
|
||||||
|
Mocker.GetMock<IMediaFileService>()
|
||||||
|
.Setup(v => v.GetFilesBySeries(1))
|
||||||
|
.Returns(episodeFiles);
|
||||||
|
|
||||||
|
GivenFileExists();
|
||||||
|
GivenSuccessfulScan();
|
||||||
|
|
||||||
|
Subject.Handle(new SeriesScannedEvent(_series));
|
||||||
|
|
||||||
|
Mocker.GetMock<IVideoFileInfoReader>()
|
||||||
|
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(2));
|
||||||
|
|
||||||
|
Mocker.GetMock<IMediaFileService>()
|
||||||
|
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_update_outdated_media_info()
|
||||||
{
|
{
|
||||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(3)
|
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(3)
|
||||||
.All()
|
.All()
|
||||||
|
@ -74,10 +100,10 @@ public void should_get_for_existing_episodefile_on_after_series_scan()
|
||||||
Subject.Handle(new SeriesScannedEvent(_series));
|
Subject.Handle(new SeriesScannedEvent(_series));
|
||||||
|
|
||||||
Mocker.GetMock<IVideoFileInfoReader>()
|
Mocker.GetMock<IVideoFileInfoReader>()
|
||||||
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(2));
|
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(3));
|
||||||
|
|
||||||
Mocker.GetMock<IMediaFileService>()
|
Mocker.GetMock<IMediaFileService>()
|
||||||
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(2));
|
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in a new issue