public async Task GetSeriesAsync_FailedResponse_ReturnsNone()
        {
            this.jsonConnection.GetAsync(Arg.Any <GetSeriesRequest>(), Arg.Any <Option <string> >())
            .Returns(new FailedRequest(HttpStatusCode.BadRequest, "Failed"));

            var tvDbClient = new TvDbClientV2(this.jsonConnection, this.fileCache, this.applicationPaths, this.logManager,
                                              new JsonSerialiser(), new PluginConfiguration());

            var seriesResult = await tvDbClient.GetSeriesAsync(4);

            seriesResult.IsSome.Should().BeFalse();
        }
        public async Task GetSeriesAsync_NoLocalSeriesData_ReturnsNewSeriesData()
        {
            var series = new TvDbSeriesData(4, "TestSeries", new DateTime(2017, 1, 1, 1, 1, 1), string.Empty, 2,
                                            AirDay.Monday, string.Empty, 4f, new[] { "Alias1", "Alias2" }, new[] { "Genre1", "Genre2" },
                                            "Overview");

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

            var tvDbClient = new TvDbClientV2(this.jsonConnection, this.fileCache, this.applicationPaths, this.logManager,
                                              new JsonSerialiser(), new PluginConfiguration());

            var seriesResult = await tvDbClient.GetSeriesAsync(4);

            seriesResult.IsSome.Should().BeTrue();
            seriesResult.ValueUnsafe().Should().Be(series);
        }
        public async Task GetSeriesAsync_NoLocalSeriesData_RequestsSeriesData()
        {
            var series = new TvDbSeriesData(4, "TestSeries", new DateTime(2017, 1, 1, 1, 1, 1), string.Empty, 2,
                                            AirDay.Monday, string.Empty, 4f, new[] { "Alias1", "Alias2" }, new[] { "Genre1", "Genre2" },
                                            "Overview");

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

            var tvDbClient = new TvDbClientV2(this.jsonConnection, this.fileCache, this.applicationPaths, this.logManager,
                                              new JsonSerialiser(), new PluginConfiguration());

            await tvDbClient.GetSeriesAsync(4);

            await this.jsonConnection.ReceivedWithAnyArgs(1)
            .GetAsync <GetSeriesRequest.Response>(null, Option <string> .None);
        }
        public async Task GetSeriesAsync_ValidSeriesId_ReturnsSeriesData()
        {
            var client = new TvDbClientV2(new JsonConnection(new TestHttpClient(), new JsonSerialiser(), this.logManager),
                                          this.fileCache, this.applicationPaths, this.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."));
        }