mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-27 23:06:29 -04:00
Dapper and STJson
Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -1,10 +1,10 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Marr.Data;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -16,6 +17,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
var files = Builder<EpisodeFile>.CreateListOfSize(10)
|
||||
.All()
|
||||
.With(c => c.Id = 0)
|
||||
.With(c => c.Language = Language.English)
|
||||
.With(c => c.Quality = new QualityModel(Quality.Bluray720p))
|
||||
.Random(4)
|
||||
.With(s => s.SeriesId = 12)
|
||||
|
||||
@@ -2,10 +2,10 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Marr.Data;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
@@ -51,12 +51,11 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
_localEpisode.Episodes = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.EpisodeFileId = 1)
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
.With(e => e.EpisodeFile = new EpisodeFile
|
||||
{
|
||||
Id = 1,
|
||||
RelativePath = @"Season 01\30.rock.s01e01.avi",
|
||||
}))
|
||||
})
|
||||
.Build()
|
||||
.ToList();
|
||||
}
|
||||
@@ -66,12 +65,11 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
_localEpisode.Episodes = Builder<Episode>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(e => e.EpisodeFileId = 1)
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
.With(e => e.EpisodeFile = new EpisodeFile
|
||||
{
|
||||
Id = 1,
|
||||
RelativePath = @"Season 01\30.rock.s01e01.avi",
|
||||
}))
|
||||
})
|
||||
.Build()
|
||||
.ToList();
|
||||
}
|
||||
@@ -80,19 +78,17 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
_localEpisode.Episodes = Builder<Episode>.CreateListOfSize(2)
|
||||
.TheFirst(1)
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
.With(e => e.EpisodeFile = new EpisodeFile
|
||||
{
|
||||
Id = 1,
|
||||
RelativePath = @"Season 01\30.rock.s01e01.avi",
|
||||
}))
|
||||
})
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = new LazyLoaded<EpisodeFile>(
|
||||
new EpisodeFile
|
||||
.With(e => e.EpisodeFile = new EpisodeFile
|
||||
{
|
||||
Id = 2,
|
||||
RelativePath = @"Season 01\30.rock.s01e02.avi",
|
||||
}))
|
||||
})
|
||||
.Build()
|
||||
.ToList();
|
||||
}
|
||||
@@ -148,7 +144,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Subject.UpgradeEpisodeFile(_episodeFile, _localEpisode);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile.Value, DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile, DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -192,7 +188,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Assert.Throws<RootFolderNotFoundException>(() => Subject.UpgradeEpisodeFile(_episodeFile, _localEpisode));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile.Value, DeleteMediaFileReason.Upgrade), Times.Never());
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile, DeleteMediaFileReason.Upgrade), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -207,7 +203,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Subject.UpgradeEpisodeFile(_episodeFile, _localEpisode);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile.Value, It.IsAny<DeleteMediaFileReason>()), Times.Never());
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localEpisode.Episodes.Single().EpisodeFile, It.IsAny<DeleteMediaFileReason>()), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user