mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 05:16:34 +02:00
Added: A Huge Cleanup of old Series Code. (Let's pray nothing breaks :P) (#2589)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
{
|
||||
@@ -15,19 +15,19 @@ namespace NzbDrone.Core.Test.Datastore
|
||||
[Test]
|
||||
public void one_to_one()
|
||||
{
|
||||
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
var episodeFile = Builder<MovieFile>.CreateNew()
|
||||
.With(c => c.Quality = new QualityModel())
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(episodeFile);
|
||||
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(c => c.EpisodeFileId = episodeFile.Id)
|
||||
var episode = Builder<Movie>.CreateNew()
|
||||
.With(c => c.MovieFileId = episodeFile.Id)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(episode);
|
||||
|
||||
var loadedEpisodeFile = Db.Single<Episode>().EpisodeFile.Value;
|
||||
var loadedEpisodeFile = Db.Single<Movie>().MovieFile;
|
||||
|
||||
loadedEpisodeFile.Should().NotBeNull();
|
||||
loadedEpisodeFile.ShouldBeEquivalentTo(episodeFile,
|
||||
@@ -35,20 +35,19 @@ namespace NzbDrone.Core.Test.Datastore
|
||||
.IncludingAllRuntimeProperties()
|
||||
.Excluding(c => c.DateAdded)
|
||||
.Excluding(c => c.Path)
|
||||
.Excluding(c => c.Series)
|
||||
.Excluding(c => c.Episodes));
|
||||
.Excluding(c => c.Movie));
|
||||
}
|
||||
|
||||
[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)
|
||||
var episode = Builder<Movie>.CreateNew()
|
||||
.With(c => c.MovieFileId = 0)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(episode);
|
||||
|
||||
Db.Single<Episode>().EpisodeFile.Value.Should().BeNull();
|
||||
Db.Single<Movie>().MovieFile.Should().BeNull();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user