null EmbeddedDocuments are now stored as DBNull instead of json null.
This commit is contained in:
parent
b0c45aef50
commit
b427954f5f
|
@ -36,6 +36,7 @@ namespace NzbDrone.Core.Test.Datastore
|
|||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(v => v.SeriesId = series[0].Id)
|
||||
.With(v => v.Quality = new QualityModel())
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(episodeFiles);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -16,6 +17,7 @@ namespace NzbDrone.Core.Test.HistoryTests
|
|||
var historyItem = Builder<History.History>.CreateListOfSize(30)
|
||||
.All()
|
||||
.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<History.History>.CreateNew().BuildNew();
|
||||
var history = Builder<History.History>.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<History.History>
|
||||
.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(c => c.Quality = new QualityModel())
|
||||
.With(c => c.EventType = HistoryEventType.Unknown)
|
||||
.Random(3)
|
||||
.With(c => c.EventType = HistoryEventType.Grabbed)
|
||||
|
|
|
@ -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<Blacklist>.CreateNew()
|
||||
.With(h => h.EpisodeIds = new List<Int32>())
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(blacklist);
|
||||
|
@ -30,6 +35,8 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
|||
Db.Insert(series);
|
||||
|
||||
var blacklist = Builder<Blacklist>.CreateNew()
|
||||
.With(h => h.EpisodeIds = new List<Int32>())
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.With(b => b.SeriesId = series.Id)
|
||||
.BuildNew();
|
||||
|
||||
|
|
|
@ -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<EpisodeFile>.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<EpisodeFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(episodeFiles);
|
||||
|
|
|
@ -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<History.History>.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<History.History>.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<History.History>.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<History.History>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.With(h => h.SeriesId = _series.Id)
|
||||
.TheFirst(1)
|
||||
.With(h => h.EpisodeId = _episode.Id)
|
||||
|
|
|
@ -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<EpisodeFile>.CreateNew()
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(series);
|
||||
|
|
|
@ -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,6 +16,8 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
|||
public void should_delete_orphaned_pending_items()
|
||||
{
|
||||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.ParsedEpisodeInfo = new ParsedEpisodeInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(pendingRelease);
|
||||
|
@ -31,6 +34,8 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
|||
|
||||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.SeriesId = series.Id)
|
||||
.With(h => h.ParsedEpisodeInfo = new ParsedEpisodeInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(pendingRelease);
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||
Subject.Execute(new DownloadedEpisodesScanCommand());
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Verify(c => c.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<bool>(), It.IsAny<Core.Qualities.QualityModel>()),
|
||||
.Verify(c => c.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<bool>(), It.IsAny<QualityModel>()),
|
||||
Times.Never());
|
||||
|
||||
VerifyNoImport();
|
||||
|
|
|
@ -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<EpisodeFile>.CreateNew().BuildNew();
|
||||
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
.With(h => h.Quality = new QualityModel())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(episodeFile);
|
||||
|
||||
|
|
|
@ -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<EpisodeFile>.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<EpisodeFile>.CreateNew()
|
||||
.With(f => f.Path = "another path")
|
||||
.With(c => c.Quality = new QualityModel())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(episodeFile);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue