@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
}
[Test]
public void should_ not_ delete_un orphaned_collection_items( )
public void should_ delete_orphaned_collection_with_meta_but_no_movie _items( )
{
var collection = Builder < MovieCollection > . CreateNew ( )
. With ( h = > h . Id = 3 )
@ -40,6 +40,27 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
Db . Insert ( movie ) ;
Subject . Clean ( ) ;
AllStoredModels . Should ( ) . HaveCount ( 0 ) ;
}
[Test]
public void should_not_delete_unorphaned_collection ( )
{
var collection = Builder < MovieCollection > . CreateNew ( )
. With ( h = > h . Id = 3 )
. With ( h = > h . TmdbId = 123456 )
. With ( h = > h . Title = "Some Credit" )
. BuildNew ( ) ;
Db . Insert ( collection ) ;
var movieMeta = Builder < MovieMetadata > . CreateNew ( ) . With ( m = > m . CollectionTmdbId = collection . TmdbId ) . BuildNew ( ) ;
Db . Insert ( movieMeta ) ;
var movie = Builder < Movie > . CreateNew ( ) . With ( m = > m . MovieMetadataId = movieMeta . Id ) . BuildNew ( ) ;
Db . Insert ( movie ) ;
Subject . Clean ( ) ;
AllStoredModels . Should ( ) . HaveCount ( 1 ) ;
}