public async Task GetSeriesAsync_ValidSeriesId_ReturnsSeriesData()
        {
            var client = new TvDbClient(new JsonConnection(new TestHttpClient(), new JsonSerialiser(), _logManager),
                                        _fileCache, _applicationPaths, _logManager, new JsonSerialiser(), new PluginConfiguration
            {
                TvDbApiKey = Secrets.TvDbApiKey
            });

            var seriesResult = await client.GetSeriesAsync(80675);

            seriesResult.IsSome.Should().BeTrue();

            var series = seriesResult.ValueUnsafe();

            series.Should().BeEquivalentTo(new TvDbSeriesData(80675, "Mobile Suit Gundam 00",
                                                              new DateTime(2007, 10, 6), "Tokyo Broadcasting System", 30, AirDay.Saturday, "6:00 PM",
                                                              9.4f, new string[] { }, new[] { "Animation", "Drama", "Science-Fiction" },
                                                              "2307 AD.\r\nAs fossil fuels became exhausted, humanity found a new energy source to change their situation: A large-scale solar power system with three enormous orbiting elevators. However, only a few large countries and their allies reaped the benefits.\r\nThree superpowers had ownership of the three orbiting elevators: The Union, based in the United States Of America, The People`s Reform League, made up of China, Russia, and India, and Europe`s AEU. The superpowers continue playing a large zero-sum game for their own dignity and respective prosperity. Even though it is the 24th century, humanity has yet to become one.\r\nIn this world where war has no end, a private militia appears advocating the eradication of war through force. Each possessing a mobile suit Gundam, they are Celestial Being. The armed intervention by the Gundams against all acts of war begins."));
        }
示例#2
0
        public async Task <SeriesBase> GetSeriesBaseRecord(int seriesId)
        {
            var baseRec = (await _client.GetSeriesAsync(seriesId).ConfigureAwait(false)).Data;
            var series  = Map(baseRec);

            try
            {
                var actorResponse = await _client.GetActorsAsync(seriesId).ConfigureAwait(false);

                var actors     = actorResponse.Data;
                var actorNames = actors.Select(actor => actor.Name);
                var actorList  = string.Join("|", actorNames);
                series.Actors = actorList;
            }
            catch (Exception)
            {
                series.Actors = string.Empty;
            }
            return(series);
        }
示例#3
0
        public async Task GetSeriesAsync_LocalSeriesData_ReturnsLocalSeriesData()
        {
            var series = new TvDbSeriesData(4, "TestSeries", new DateTime(2017, 1, 1, 1, 1, 1), "", 2,
                                            AirDay.Monday, "", 4f, new[] { "Alias1", "Alias2" }, new[] { "Genre1", "Genre2" },
                                            "Overview");

            _fileCache.GetFileContent(Arg.Any <TvDbSeriesFileSpec>())
            .Returns(series);

            _jsonConnection.GetAsync(Arg.Any <GetSeriesRequest>(), Arg.Any <Option <string> >())
            .Returns(new Response <GetSeriesRequest.Response>(new GetSeriesRequest.Response(series)));

            var tvDbClient = new TvDbClient(_jsonConnection, _fileCache, _applicationPaths, _logManager,
                                            new JsonSerialiser(), new PluginConfiguration());

            var seriesResult = await tvDbClient.GetSeriesAsync(4);

            seriesResult.IsSome.Should().BeTrue();
            seriesResult.ValueUnsafe().Should().BeEquivalentTo(series);
        }
示例#4
0
        public async Task GetSeriesAsync_LocalSeriesData_DoesNotRequestSeriesData()
        {
            var series = new TvDbSeriesData(4, "TestSeries", new DateTime(2017, 1, 1, 1, 1, 1), "", 2,
                                            AirDay.Monday, "", 4f, new[] { "Alias1", "Alias2" }, new[] { "Genre1", "Genre2" },
                                            "Overview");

            _fileCache.GetFileContent(Arg.Any <TvDbSeriesFileSpec>())
            .Returns(series);

            _jsonConnection.GetAsync(Arg.Any <GetSeriesRequest>(), Arg.Any <Option <string> >())
            .Returns(new Response <GetSeriesRequest.Response>(new GetSeriesRequest.Response(series)));

            var tvDbClient = new TvDbClient(_jsonConnection, _fileCache, _applicationPaths, _logManager,
                                            new JsonSerialiser(), new PluginConfiguration());

            await tvDbClient.GetSeriesAsync(4);

            _jsonConnection.DidNotReceiveWithAnyArgs()
            .GetAsync <GetSeriesRequest.Response>(null, Option <string> .None);
        }