public void FindEpisode_NoSeasonIndexProvided_MatchesOnTitle()
        {
            var episodes = new[]
            {
                new AniDbEpisodeData
                {
                    Id = 122,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "88",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "OtherEpisode",
                            Type     = "Official"
                        }
                    }
                },
                new AniDbEpisodeData
                {
                    Id = 442,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "55",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "EpisodeTitle",
                            Type     = "Official"
                        }
                    }
                }
            };

            var episodeMatcher = new AniDbEpisodeMatcher(this.titleNormaliser, this.logManager);

            var foundEpisode =
                episodeMatcher.FindEpisode(episodes, Option <int> .None, 3, "EpisodeTitle");

            foundEpisode.ValueUnsafe().Should().Be(episodes[1]);
        }
        public void FindEpisode_NoTitleMatch_ReturnsNone()
        {
            var episodes = new[]
            {
                new AniDbEpisodeData
                {
                    Id = 122,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "88",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "OtherEpisode",
                            Type     = "Official"
                        }
                    }
                },
                new AniDbEpisodeData
                {
                    Id = 442,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "55",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "EpisodeTitle",
                            Type     = "Official"
                        }
                    }
                }
            };

            var episodeMatcher = new AniDbEpisodeMatcher(this.titleNormaliser, this.logManager);

            var foundEpisode = episodeMatcher.FindEpisode(episodes, Option <int> .None, 3, "Title");

            foundEpisode.IsSome.Should().BeFalse();
        }
        public void FindEpisode_SeasonAndEpisodeIndexesProvided_MatchesOnIndexes()
        {
            var episodes = new[]
            {
                new AniDbEpisodeData
                {
                    Id = 122,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "88",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "OtherEpisode",
                            Type     = "Official"
                        }
                    }
                },
                new AniDbEpisodeData
                {
                    Id = 442,
                    RawEpisodeNumber = new EpisodeNumberData
                    {
                        RawNumber = "55",
                        RawType   = 1
                    },
                    Titles = new[]
                    {
                        new EpisodeTitleData
                        {
                            Language = "en",
                            Title    = "EpisodeTitle",
                            Type     = "Official"
                        }
                    }
                }
            };

            var episodeMatcher = new AniDbEpisodeMatcher(_titleNormaliser, _logManager);

            var foundEpisode = episodeMatcher.FindEpisode(episodes, 1, 55, Option <string> .None);

            foundEpisode.ValueUnsafe().Should().Be(episodes[1]);
        }