diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs index 5bc79d72b..45b5af5c6 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs @@ -27,7 +27,10 @@ public void Setup() Mocker.Resolve(); _movie = Builder.CreateNew() - .With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() }) + .With(e => e.Profile = new Profile { + Items = Qualities.QualityFixture.GetDefaultQualities(), + UpgradeAllowed = true + }) .Build(); _otherMovie = Builder.CreateNew() @@ -47,11 +50,11 @@ private void GivenEmptyQueue() .Returns(new List()); } - private void GivenQueue(IEnumerable remoteEpisodes) + private void GivenQueue(IEnumerable remoteMovies) { - var queue = remoteEpisodes.Select(remoteEpisode => new Queue.Queue + var queue = remoteMovies.Select(remoteMovie => new Queue.Queue { - RemoteMovie = remoteEpisode + RemoteMovie = remoteMovie }); Mocker.GetMock() @@ -67,13 +70,13 @@ public void should_return_true_when_queue_is_empty() } [Test] - public void should_return_true_when_series_doesnt_match() + public void should_return_true_when_movie_doesnt_match() { - var remoteEpisode = Builder.CreateNew() + var remoteMovie = Builder.CreateNew() .With(r => r.Movie = _otherMovie) .Build(); - GivenQueue(new List { remoteEpisode }); + GivenQueue(new List { remoteMovie }); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue(); } @@ -82,7 +85,7 @@ public void should_return_true_when_quality_in_queue_is_lower() { _movie.Profile.Value.Cutoff = Quality.Bluray1080p.Id; - var remoteEpisode = Builder.CreateNew() + var remoteMovie = Builder.CreateNew() .With(r => r.Movie = _movie) .With(r => r.ParsedMovieInfo = new ParsedMovieInfo { @@ -90,14 +93,14 @@ public void should_return_true_when_quality_in_queue_is_lower() }) .Build(); - GivenQueue(new List { remoteEpisode }); + GivenQueue(new List { remoteMovie }); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue(); } [Test] public void should_return_false_when_qualities_are_the_same() { - var remoteEpisode = Builder.CreateNew() + var remoteMovie = Builder.CreateNew() .With(r => r.Movie = _movie) .With(r => r.ParsedMovieInfo = new ParsedMovieInfo { @@ -105,7 +108,7 @@ public void should_return_false_when_qualities_are_the_same() }) .Build(); - GivenQueue(new List { remoteEpisode }); + GivenQueue(new List { remoteMovie }); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse(); } @@ -114,7 +117,7 @@ public void should_return_false_when_quality_in_queue_is_better() { _movie.Profile.Value.Cutoff = Quality.Bluray1080p.Id; - var remoteEpisode = Builder.CreateNew() + var remoteMovie = Builder.CreateNew() .With(r => r.Movie = _movie) .With(r => r.ParsedMovieInfo = new ParsedMovieInfo { @@ -122,7 +125,7 @@ public void should_return_false_when_quality_in_queue_is_better() }) .Build(); - GivenQueue(new List { remoteEpisode }); + GivenQueue(new List { remoteMovie }); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse(); } @@ -131,7 +134,7 @@ public void should_return_false_if_quality_in_queue_meets_cutoff() { _movie.Profile.Value.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id; - var remoteEpisode = Builder.CreateNew() + var remoteMovie = Builder.CreateNew() .With(r => r.Movie = _movie) .With(r => r.ParsedMovieInfo = new ParsedMovieInfo { @@ -139,9 +142,28 @@ public void should_return_false_if_quality_in_queue_meets_cutoff() }) .Build(); - GivenQueue(new List { remoteEpisode }); + GivenQueue(new List { remoteMovie }); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse(); } + + + [Test] + public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_false_for_quality_profile() + { + _movie.Profile.Value.Cutoff = Quality.Bluray1080p.Id; + _movie.Profile.Value.UpgradeAllowed = false; + + var remoteMovie = Builder.CreateNew() + .With(r => r.Movie = _movie) + .With(r => r.ParsedMovieInfo = new ParsedMovieInfo + { + Quality = new QualityModel(Quality.Bluray1080p) + }) + .Build(); + + GivenQueue(new List { remoteMovie }); + Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse(); + } } }