mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: QueueSpecificationFixture Test
This commit is contained in:
parent
f6b4a463b1
commit
ada9b944dc
@ -27,7 +27,10 @@ public void Setup()
|
||||
Mocker.Resolve<UpgradableSpecification>();
|
||||
|
||||
_movie = Builder<Movie>.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<Movie>.CreateNew()
|
||||
@ -47,11 +50,11 @@ private void GivenEmptyQueue()
|
||||
.Returns(new List<Queue.Queue>());
|
||||
}
|
||||
|
||||
private void GivenQueue(IEnumerable<RemoteMovie> remoteEpisodes)
|
||||
private void GivenQueue(IEnumerable<RemoteMovie> remoteMovies)
|
||||
{
|
||||
var queue = remoteEpisodes.Select(remoteEpisode => new Queue.Queue
|
||||
var queue = remoteMovies.Select(remoteMovie => new Queue.Queue
|
||||
{
|
||||
RemoteMovie = remoteEpisode
|
||||
RemoteMovie = remoteMovie
|
||||
});
|
||||
|
||||
Mocker.GetMock<IQueueService>()
|
||||
@ -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<RemoteMovie>.CreateNew()
|
||||
var remoteMovie = Builder<RemoteMovie>.CreateNew()
|
||||
.With(r => r.Movie = _otherMovie)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteMovie> { remoteEpisode });
|
||||
GivenQueue(new List<RemoteMovie> { 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<RemoteMovie>.CreateNew()
|
||||
var remoteMovie = Builder<RemoteMovie>.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<RemoteMovie> { remoteEpisode });
|
||||
GivenQueue(new List<RemoteMovie> { remoteMovie });
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_when_qualities_are_the_same()
|
||||
{
|
||||
var remoteEpisode = Builder<RemoteMovie>.CreateNew()
|
||||
var remoteMovie = Builder<RemoteMovie>.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<RemoteMovie> { remoteEpisode });
|
||||
GivenQueue(new List<RemoteMovie> { 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<RemoteMovie>.CreateNew()
|
||||
var remoteMovie = Builder<RemoteMovie>.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<RemoteMovie> { remoteEpisode });
|
||||
GivenQueue(new List<RemoteMovie> { 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<RemoteMovie>.CreateNew()
|
||||
var remoteMovie = Builder<RemoteMovie>.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<RemoteMovie> { remoteEpisode });
|
||||
GivenQueue(new List<RemoteMovie> { 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<RemoteMovie>.CreateNew()
|
||||
.With(r => r.Movie = _movie)
|
||||
.With(r => r.ParsedMovieInfo = new ParsedMovieInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.Bluray1080p)
|
||||
})
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteMovie> { remoteMovie });
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user