|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
@ -72,29 +73,41 @@ namespace NzbDrone.Core.Test.Datastore
|
|
|
|
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
|
|
|
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
|
|
|
}*/
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
// [Test]
|
|
|
|
[Test]
|
|
|
|
// public void one_to_one()
|
|
|
|
public void one_to_one()
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// var episode = Builder<Episode>.CreateNew()
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
// .With(c => c.Id = 0)
|
|
|
|
.BuildNew();
|
|
|
|
// .Build();
|
|
|
|
|
|
|
|
//
|
|
|
|
Db.Insert(episodeFile);
|
|
|
|
// Db.Insert(episode);
|
|
|
|
|
|
|
|
//
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
//
|
|
|
|
.With(c => c.EpisodeFileId = episodeFile.Id)
|
|
|
|
// var history = Builder<History.History>.CreateNew()
|
|
|
|
.BuildNew();
|
|
|
|
// .With(c => c.Id = 0)
|
|
|
|
|
|
|
|
// .With(c => c.EpisodeId = episode.Id)
|
|
|
|
Db.Insert(episode);
|
|
|
|
// .With(c => c.Quality = new QualityModel())
|
|
|
|
|
|
|
|
// .Build();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// Db.Insert(history);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// var loadedEpisode = Db.Single<History.History>().Episode.Value;
|
|
|
|
var loadedEpisodeFile = Db.Single<Episode>().EpisodeFile.Value;
|
|
|
|
//
|
|
|
|
|
|
|
|
// loadedEpisode.Should().NotBeNull();
|
|
|
|
loadedEpisodeFile.Should().NotBeNull();
|
|
|
|
// loadedEpisode.ShouldHave().AllProperties().But(c => c.SeriesTitle).EqualTo(episode);
|
|
|
|
loadedEpisodeFile.ShouldHave().AllProperties().But(c => c.DateAdded).EqualTo(episodeFile);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void one_to_one_should_not_query_db_if_foreign_key_is_zero()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(c => c.EpisodeFileId = 0)
|
|
|
|
|
|
|
|
.BuildNew();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db.Insert(episode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db.Single<Episode>().EpisodeFile.Value.Should().BeNull();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|