Ejemplo n.º 1
0
        public async Task Test_ListItemObjectJsonReader_Person_ReadObject_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ListItemObjectJsonReader();

            using (var stream = TYPE_PERSON_JSON_NOT_VALID_2.ToStream())
            {
                var traktListItem = await jsonReader.ReadObjectAsync(stream);

                traktListItem.Should().NotBeNull();
                traktListItem.Rank.Should().Be("1");
                traktListItem.ListedAt.Should().BeNull();
                traktListItem.Type.Should().Be(TraktListItemType.Person);
                traktListItem.Person.Should().NotBeNull();
                traktListItem.Person.Name.Should().Be("Bryan Cranston");
                traktListItem.Person.Ids.Should().NotBeNull();
                traktListItem.Person.Ids.Trakt.Should().Be(297737U);
                traktListItem.Person.Ids.Slug.Should().Be("bryan-cranston");
                traktListItem.Person.Ids.Imdb.Should().Be("nm0186505");
                traktListItem.Person.Ids.Tmdb.Should().Be(17419U);
                traktListItem.Person.Ids.TvRage.Should().Be(1797U);

                traktListItem.Movie.Should().BeNull();
                traktListItem.Show.Should().BeNull();
                traktListItem.Season.Should().BeNull();
                traktListItem.Episode.Should().BeNull();
            }
        }
        public async Task Test_SearchResultArrayJsonReader_Person_ReadArray_From_Stream_Not_Valid_2()
        {
            var jsonReader = new ArrayJsonReader <ITraktSearchResult>();

            using (var stream = TYPE_PERSON_JSON_NOT_VALID_2.ToStream())
            {
                IEnumerable <ITraktSearchResult> traktSearchResults = await jsonReader.ReadArrayAsync(stream);

                traktSearchResults.Should().NotBeNull();
                ITraktSearchResult[] searchResults = traktSearchResults.ToArray();

                searchResults[0].Should().NotBeNull();
                searchResults[0].Type.Should().Be(TraktSearchResultType.Person);
                searchResults[0].Score.Should().Be(46.29501f);
                searchResults[0].Person.Should().NotBeNull();
                searchResults[0].Person.Name.Should().Be("Bryan Cranston");
                searchResults[0].Person.Ids.Should().NotBeNull();
                searchResults[0].Person.Ids.Trakt.Should().Be(297737U);
                searchResults[0].Person.Ids.Slug.Should().Be("bryan-cranston");
                searchResults[0].Person.Ids.Imdb.Should().Be("nm0186505");
                searchResults[0].Person.Ids.Tmdb.Should().Be(17419U);
                searchResults[0].Person.Ids.TvRage.Should().Be(1797U);

                searchResults[0].Movie.Should().BeNull();
                searchResults[0].Show.Should().BeNull();
                searchResults[0].Episode.Should().BeNull();
                searchResults[0].List.Should().BeNull();

                searchResults[1].Should().NotBeNull();
                searchResults[1].Type.Should().Be(TraktSearchResultType.Person);
                searchResults[1].Score.Should().BeNull();
                searchResults[1].Person.Should().NotBeNull();
                searchResults[1].Person.Name.Should().Be("Bryan Cranston");
                searchResults[1].Person.Ids.Should().NotBeNull();
                searchResults[1].Person.Ids.Trakt.Should().Be(297737U);
                searchResults[1].Person.Ids.Slug.Should().Be("bryan-cranston");
                searchResults[1].Person.Ids.Imdb.Should().Be("nm0186505");
                searchResults[1].Person.Ids.Tmdb.Should().Be(17419U);
                searchResults[1].Person.Ids.TvRage.Should().Be(1797U);

                searchResults[1].Movie.Should().BeNull();
                searchResults[1].Show.Should().BeNull();
                searchResults[1].Episode.Should().BeNull();
                searchResults[1].List.Should().BeNull();
            }
        }