コード例 #1
0
        public void TestMappingNameWithID()
        {
            var lawOrderProgram = new TestProgram("Law & Order: Special Victims Unit", "Identity", 0, "S06E12");
            var seriesNameMap   = new Dictionary <string, string>(1);

            seriesNameMap.Add("Law & Order: Special Victims Unit", "id=75692");
            var mockConfig = new Moq.Mock <IConfiguration>();

            mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
            var tvDbApi  = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
            var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
            var series   = enricher.GetTvdbSeries(enricher.getSeriesId(lawOrderProgram.Title), false);

            enricher.EnrichProgram(lawOrderProgram, series);
            Assert.True(lawOrderProgram.EpisodeIsEnriched());
        }
コード例 #2
0
        public void TestMappingRegex()
        {
            var lawOrderProgram = new TestProgram("Stargate Atlantis123", "Common Ground", 0, "S03E07");
            var seriesNameMap   = new Dictionary <string, string>(1);

            seriesNameMap.Add("regex=Stargate Atl.*", "Stargate Atlantis");
            var mockConfig = new Moq.Mock <IConfiguration>();

            mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
            var tvDbApi  = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
            var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
            var series   = enricher.GetTvdbSeries(enricher.getSeriesId(lawOrderProgram.Title), false);

            enricher.EnrichProgram(lawOrderProgram, series);
            Assert.True(lawOrderProgram.EpisodeIsEnriched());
        }
コード例 #3
0
        public void TestBlackSails()
        {
            // Arrange
            var program       = new TestProgram("Black Sails", "XVIII.", 0, "S02E10");
            var seriesNameMap = new Dictionary <string, string>(1);
            //seriesNameMap.Add("Blue Bloods", "id=164981");
            var mockConfig = new Moq.Mock <IConfiguration>();

            mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
            mockConfig.Setup(x => x.UpdateMatchedEpisodes).Returns(true);
            mockConfig.Setup(x => x.UpdateSubtitlesParameter).Returns(true);
            mockConfig.Setup(x => x.GetProperty(Moq.It.Is <string>((c) => c == "TvDbLanguage"))).Returns("en");
            var tvDbApi  = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
            var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
            var series   = enricher.GetTvdbSeries(enricher.getSeriesId(program.Title), false);

            // Act
            enricher.EnrichProgram(program, series);
            // Assert
            program.Assert();
        }
コード例 #4
0
        public void TestAgathaChristiesMarple()
        {
            // Arrange
            var program       = new TestProgram("Agatha Christie's Marple", "Murder at the Vicarage", 0, "S01E02");
            var seriesNameMap = new Dictionary <string, string>(1);

            seriesNameMap.Add("Agatha Christie's Marple", "id=78895");
            var mockConfig = new Moq.Mock <IConfiguration>();

            mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
            mockConfig.Setup(x => x.UpdateMatchedEpisodes).Returns(true);
            mockConfig.Setup(x => x.UpdateSubtitlesParameter).Returns(true);
            var tvDbApi  = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
            var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
            var series   = enricher.GetTvdbSeries(enricher.getSeriesId(program.Title), false);

            // Act
            enricher.EnrichProgram(program, series);
            // Assert
            program.Assert();
        }
コード例 #5
0
 public void TestMappingNameWithID()
 {
     var lawOrderProgram = new TestProgram("Law & Order: Special Victims Unit", "Identity", 0, "S06E12");
     var seriesNameMap = new Dictionary<string, string>(1);
     seriesNameMap.Add("Law & Order: Special Victims Unit", "id=75692");
     var mockConfig = new Moq.Mock<IConfiguration>();
     mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
     var tvDbApi = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
     var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
     var series = enricher.GetTvdbSeries(enricher.getSeriesId(lawOrderProgram.Title), false);
     enricher.EnrichProgram(lawOrderProgram, series);
     Assert.True(lawOrderProgram.EpisodeIsEnriched());
 }
コード例 #6
0
 public void TestBlackSails()
 {
     // Arrange
     var program = new TestProgram("Black Sails", "XVIII.", 0, "S02E10");
     var seriesNameMap = new Dictionary<string, string>(1);
     //seriesNameMap.Add("Blue Bloods", "id=164981");
     var mockConfig = new Moq.Mock<IConfiguration>();
     mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
     mockConfig.Setup(x => x.UpdateMatchedEpisodes).Returns(true);
     mockConfig.Setup(x => x.UpdateSubtitlesParameter).Returns(true);
     mockConfig.Setup(x => x.GetProperty(Moq.It.Is<string>((c) => c == "TvDbLanguage"))).Returns("en");
     var tvDbApi = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
     var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
     var series = enricher.GetTvdbSeries(enricher.getSeriesId(program.Title), false);
     // Act
     enricher.EnrichProgram(program, series);
     // Assert
     program.Assert();
 }        
コード例 #7
0
 public void TestAgathaChristiesMarple()
 {
     // Arrange
     var program = new TestProgram("Agatha Christie's Marple", "Murder at the Vicarage", 0, "S01E02");
     var seriesNameMap = new Dictionary<string, string>(1);
     seriesNameMap.Add("Agatha Christie's Marple", "id=78895");
     var mockConfig = new Moq.Mock<IConfiguration>();
     mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
     mockConfig.Setup(x => x.UpdateMatchedEpisodes).Returns(true);
     mockConfig.Setup(x => x.UpdateSubtitlesParameter).Returns(true);
     var tvDbApi = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
     var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
     var series = enricher.GetTvdbSeries(enricher.getSeriesId(program.Title), false);
     // Act
     enricher.EnrichProgram(program, series);
     // Assert
     program.Assert();
 }
コード例 #8
0
 public void TestRegularMapping()
 {
     var lawOrderProgram = new TestProgram("Stargate Atlantis123", "Common Ground", 0, "S03E07");
     var seriesNameMap = new Dictionary<string, string>(1);
     seriesNameMap.Add("Stargate Atlantis123", "Stargate Atlantis");
     var mockConfig = new Moq.Mock<IConfiguration>();
     mockConfig.Setup(x => x.getSeriesNameMap()).Returns(seriesNameMap);
     //
     var tvDbApi = new TvDbService(GetWorkingDirectory(), Config.Instance.ApiKey);
     var enricher = new TvdbLibAccess(mockConfig.Object, EpisodeMatchMethodLoader.GetMatchMethods(), tvDbApi);
     var series = enricher.GetTvdbSeries(enricher.getSeriesId(lawOrderProgram.Title), false);
     enricher.EnrichProgram(lawOrderProgram, series);
     Assert.True(lawOrderProgram.EpisodeIsEnriched());
 }