Exemplo n.º 1
0
        public void GetEpisodes_Should_Return_Virtual_Episode_List_When_FirstAired_Is_Empty()
        {
            var returnObject = new TvdbEpisodes()
            {
                Links = new Links
                {
                    Next = null
                },
                Data = new List <Data>(2)
                {
                    new Data
                    {
                        Id = 1,
                        AiredEpisodeNumber = 1,
                        AiredSeason        = 1,
                        FirstAired         = "",
                        EpisodeName        = "test1"
                    }
                }
            };
            var client = CreateClient(returnObject, HttpStatusCode.OK);

            var result = client.GetEpisodes("12").ToList();

            result.Count.Should().Be(0);
        }
Exemplo n.º 2
0
        public void GetEpisodes_Should_Return_Virtual_Episode_List()
        {
            var returnObject = new TvdbEpisodes()
            {
                Links = new Links
                {
                    Next = null
                },
                Data = new List <Data>(2)
                {
                    new Data
                    {
                        Id = 1,
                        AiredEpisodeNumber = 1,
                        AiredSeason        = 1,
                        FirstAired         = new DateTime(2019, 10, 20).ToString("O"),
                        EpisodeName        = "test1"
                    }, new Data
                    {
                        Id = 2,
                        AiredEpisodeNumber = 2,
                        AiredSeason        = 2,
                        FirstAired         = new DateTime(2019, 10, 21).ToString("O"),
                        EpisodeName        = "test2"
                    }
                }
            };
            var client = CreateClient(returnObject, HttpStatusCode.OK);

            var result = client.GetEpisodes("12").ToList();

            result.Count.Should().Be(2);

            result[0].Id.Should().Be(returnObject.Data[0].Id.ToString());
            result[0].EpisodeNumber.Should().Be(returnObject.Data[0].AiredEpisodeNumber);
            // ReSharper disable once PossibleInvalidOperationException
            result[0].FirstAired.Value.ToString("O").Should().Be(returnObject.Data[0].FirstAired);
            result[0].Name.Should().Be(returnObject.Data[0].EpisodeName);
            result[0].SeasonNumber.Should().Be(returnObject.Data[0].AiredSeason);

            result[1].Id.Should().Be(returnObject.Data[1].Id.ToString());
            result[1].EpisodeNumber.Should().Be(returnObject.Data[1].AiredEpisodeNumber);
            // ReSharper disable once PossibleInvalidOperationException
            result[1].FirstAired.Value.ToString("O").Should().Be(returnObject.Data[1].FirstAired);
            result[1].Name.Should().Be(returnObject.Data[1].EpisodeName);
            result[1].SeasonNumber.Should().Be(returnObject.Data[1].AiredSeason);
        }