diff --git a/src/NzbDrone.Core.Test/Datastore/MarrDataLazyLoadingFixture.cs b/src/NzbDrone.Core.Test/Datastore/MarrDataLazyLoadingFixture.cs index 8cf59717b..49d67f063 100644 --- a/src/NzbDrone.Core.Test/Datastore/MarrDataLazyLoadingFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/MarrDataLazyLoadingFixture.cs @@ -36,6 +36,7 @@ namespace NzbDrone.Core.Test.Datastore var episodeFiles = Builder.CreateListOfSize(1) .All() .With(v => v.SeriesId = series[0].Id) + .With(v => v.Quality = new QualityModel()) .BuildListOfNew(); Db.InsertMany(episodeFiles); diff --git a/src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs b/src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs index e2da6251c..34b6936bb 100644 --- a/src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs +++ b/src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs @@ -4,6 +4,7 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.History; using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.Qualities; namespace NzbDrone.Core.Test.HistoryTests { @@ -15,7 +16,8 @@ namespace NzbDrone.Core.Test.HistoryTests { var historyItem = Builder.CreateListOfSize(30) .All() - .With(c=>c.Id = 0) + .With(c => c.Id = 0) + .With(c => c.Quality = new QualityModel()) .TheFirst(10).With(c => c.Date = DateTime.Now) .TheNext(20).With(c => c.Date = DateTime.Now.AddDays(-31)) .Build(); @@ -32,7 +34,9 @@ namespace NzbDrone.Core.Test.HistoryTests [Test] public void should_read_write_dictionary() { - var history = Builder.CreateNew().BuildNew(); + var history = Builder.CreateNew() + .With(c => c.Quality = new QualityModel()) + .BuildNew(); history.Data.Add("key1","value1"); history.Data.Add("key2","value2"); @@ -48,6 +52,7 @@ namespace NzbDrone.Core.Test.HistoryTests var history = Builder .CreateListOfSize(5) .All() + .With(c => c.Quality = new QualityModel()) .With(c => c.EventType = HistoryEventType.Unknown) .Random(3) .With(c => c.EventType = HistoryEventType.Grabbed) diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedBlacklistFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedBlacklistFixture.cs index 350471a1d..e5c3c077e 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedBlacklistFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedBlacklistFixture.cs @@ -3,8 +3,11 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Blacklisting; using NzbDrone.Core.Housekeeping.Housekeepers; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; +using System; +using System.Collections.Generic; namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { @@ -15,6 +18,8 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers public void should_delete_orphaned_blacklist_items() { var blacklist = Builder.CreateNew() + .With(h => h.EpisodeIds = new List()) + .With(h => h.Quality = new QualityModel()) .BuildNew(); Db.Insert(blacklist); @@ -30,8 +35,10 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers Db.Insert(series); var blacklist = Builder.CreateNew() - .With(b => b.SeriesId = series.Id) - .BuildNew(); + .With(h => h.EpisodeIds = new List()) + .With(h => h.Quality = new QualityModel()) + .With(b => b.SeriesId = series.Id) + .BuildNew(); Db.Insert(blacklist); diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFilesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFilesFixture.cs index 0c97d0ae7..b09def40c 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFilesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFilesFixture.cs @@ -6,6 +6,7 @@ using NzbDrone.Core.Housekeeping.Housekeepers; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; +using NzbDrone.Core.Qualities; namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { @@ -16,6 +17,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers public void should_delete_orphaned_episode_files() { var episodeFile = Builder.CreateNew() + .With(h => h.Quality = new QualityModel()) .BuildNew(); Db.Insert(episodeFile); @@ -27,6 +29,8 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers public void should_not_delete_unorphaned_episode_files() { var episodeFiles = Builder.CreateListOfSize(2) + .All() + .With(h => h.Quality = new QualityModel()) .BuildListOfNew(); Db.InsertMany(episodeFiles); diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs index 3ebf89dbd..022248abd 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs @@ -2,6 +2,7 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Housekeeping.Housekeepers; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; @@ -39,6 +40,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers GivenEpisode(); var history = Builder.CreateNew() + .With(h => h.Quality = new QualityModel()) .With(h => h.EpisodeId = _episode.Id) .BuildNew(); Db.Insert(history); @@ -53,6 +55,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers GivenSeries(); var history = Builder.CreateNew() + .With(h => h.Quality = new QualityModel()) .With(h => h.SeriesId = _series.Id) .BuildNew(); Db.Insert(history); @@ -69,6 +72,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers var history = Builder.CreateListOfSize(2) .All() + .With(h => h.Quality = new QualityModel()) .With(h => h.EpisodeId = _episode.Id) .TheFirst(1) .With(h => h.SeriesId = _series.Id) @@ -89,6 +93,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers var history = Builder.CreateListOfSize(2) .All() + .With(h => h.Quality = new QualityModel()) .With(h => h.SeriesId = _series.Id) .TheFirst(1) .With(h => h.EpisodeId = _episode.Id) diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs index 4ea0046c3..7e4dc060f 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs @@ -5,6 +5,7 @@ using NzbDrone.Core.Housekeeping.Housekeepers; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Metadata; using NzbDrone.Core.Metadata.Files; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; @@ -68,6 +69,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers .BuildNew(); var episodeFile = Builder.CreateNew() + .With(h => h.Quality = new QualityModel()) .BuildNew(); Db.Insert(series); diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedPendingReleasesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedPendingReleasesFixture.cs index 34965efae..104ba9bfc 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedPendingReleasesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedPendingReleasesFixture.cs @@ -3,6 +3,7 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Download.Pending; using NzbDrone.Core.Housekeeping.Housekeepers; +using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; @@ -15,7 +16,9 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers public void should_delete_orphaned_pending_items() { var pendingRelease = Builder.CreateNew() - .BuildNew(); + .With(h => h.ParsedEpisodeInfo = new ParsedEpisodeInfo()) + .With(h => h.Release = new ReleaseInfo()) + .BuildNew(); Db.Insert(pendingRelease); Subject.Clean(); @@ -30,8 +33,10 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers Db.Insert(series); var pendingRelease = Builder.CreateNew() - .With(h => h.SeriesId = series.Id) - .BuildNew(); + .With(h => h.SeriesId = series.Id) + .With(h => h.ParsedEpisodeInfo = new ParsedEpisodeInfo()) + .With(h => h.Release = new ReleaseInfo()) + .BuildNew(); Db.Insert(pendingRelease); diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs index 3cc90f748..ad3d85bbb 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs @@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.MediaFiles Subject.Execute(new DownloadedEpisodesScanCommand()); Mocker.GetMock() - .Verify(c => c.GetImportDecisions(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny()), + .Verify(c => c.GetImportDecisions(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never()); VerifyNoImport(); diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs index 1a7f06151..07a43b9ca 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs @@ -2,6 +2,7 @@ using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.MediaFiles; +using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; @@ -25,7 +26,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests [Test] public void should_get_episodes_by_file() { - var episodeFile = Builder.CreateNew().BuildNew(); + var episodeFile = Builder.CreateNew() + .With(h => h.Quality = new QualityModel()) + .BuildNew(); Db.Insert(episodeFile); diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs index 5dd3b03d2..3925850ee 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithFilesFixture.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Tv; +using NzbDrone.Core.Qualities; namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests { @@ -21,8 +22,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests public void Setup() { _episodeFiles = Builder.CreateListOfSize(5) - .BuildListOfNew() - .ToList(); + .All() + .With(c => c.Quality = new QualityModel()) + .BuildListOfNew(); Db.InsertMany(_episodeFiles); @@ -56,6 +58,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests { var episodeFile = Builder.CreateNew() .With(f => f.Path = "another path") + .With(c => c.Quality = new QualityModel()) .BuildNew(); Db.Insert(episodeFile); diff --git a/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs index 806bbf5f4..222c53b2a 100644 --- a/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs @@ -55,6 +55,7 @@ namespace NzbDrone.Core.Datastore.Converters public object ToDB(object clrValue) { if (clrValue == null) return null; + if (clrValue == DBNull.Value) return DBNull.Value; return JsonConvert.SerializeObject(clrValue, SerializerSetting); }