2018-03-14 20:41:36 +00:00
|
|
|
using System.Collections.Generic;
|
2014-12-14 19:52:50 +00:00
|
|
|
using System.Linq;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.MetadataSource;
|
2018-03-14 20:41:36 +00:00
|
|
|
using NzbDrone.Core.Movies;
|
2019-12-22 22:08:53 +00:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
2014-12-14 19:52:50 +00:00
|
|
|
|
2015-05-07 15:43:52 +00:00
|
|
|
namespace NzbDrone.Core.Test.MetadataSource
|
2014-12-14 19:52:50 +00:00
|
|
|
{
|
|
|
|
[TestFixture]
|
2018-03-14 20:41:36 +00:00
|
|
|
public class SearchMovieComparerFixture : CoreTest
|
2014-12-14 19:52:50 +00:00
|
|
|
{
|
2018-03-14 20:41:36 +00:00
|
|
|
private List<Movie> _series;
|
2014-12-14 19:52:50 +00:00
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
2018-03-14 20:41:36 +00:00
|
|
|
_series = new List<Movie>();
|
2014-12-14 19:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void WithSeries(string title)
|
|
|
|
{
|
2018-03-14 20:41:36 +00:00
|
|
|
_series.Add(new Movie { Title = title });
|
2014-12-14 19:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_prefer_the_walking_dead_over_talking_dead_when_searching_for_the_walking_dead()
|
|
|
|
{
|
|
|
|
WithSeries("Talking Dead");
|
|
|
|
WithSeries("The Walking Dead");
|
|
|
|
|
2018-03-14 20:41:36 +00:00
|
|
|
_series.Sort(new SearchMovieComparer("the walking dead"));
|
2014-12-14 19:52:50 +00:00
|
|
|
|
|
|
|
_series.First().Title.Should().Be("The Walking Dead");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void should_prefer_the_walking_dead_over_talking_dead_when_searching_for_walking_dead()
|
|
|
|
{
|
|
|
|
WithSeries("Talking Dead");
|
|
|
|
WithSeries("The Walking Dead");
|
|
|
|
|
2018-03-14 20:41:36 +00:00
|
|
|
_series.Sort(new SearchMovieComparer("walking dead"));
|
2014-12-14 19:52:50 +00:00
|
|
|
|
|
|
|
_series.First().Title.Should().Be("The Walking Dead");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2021-08-19 19:13:14 +00:00
|
|
|
public void should_prefer_blocklist_over_the_blocklist_when_searching_for_blocklist()
|
2014-12-14 19:52:50 +00:00
|
|
|
{
|
2021-08-19 19:13:14 +00:00
|
|
|
WithSeries("The Blocklist");
|
|
|
|
WithSeries("Blocklist");
|
2014-12-14 19:52:50 +00:00
|
|
|
|
2021-08-19 19:13:14 +00:00
|
|
|
_series.Sort(new SearchMovieComparer("blocklist"));
|
2014-12-14 19:52:50 +00:00
|
|
|
|
2021-08-19 19:13:14 +00:00
|
|
|
_series.First().Title.Should().Be("Blocklist");
|
2014-12-14 19:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2021-08-19 19:13:14 +00:00
|
|
|
public void should_prefer_the_blocklist_over_blocklist_when_searching_for_the_blocklist()
|
2014-12-14 19:52:50 +00:00
|
|
|
{
|
2021-08-19 19:13:14 +00:00
|
|
|
WithSeries("Blocklist");
|
|
|
|
WithSeries("The Blocklist");
|
2014-12-14 19:52:50 +00:00
|
|
|
|
2021-08-19 19:13:14 +00:00
|
|
|
_series.Sort(new SearchMovieComparer("the blocklist"));
|
2014-12-14 19:52:50 +00:00
|
|
|
|
2021-08-19 19:13:14 +00:00
|
|
|
_series.First().Title.Should().Be("The Blocklist");
|
2014-12-14 19:52:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|