public async Task Test_TraktMoviesModule_GetMovieRatings()
        {
            TraktClient client = TestUtility.GetMockClient(GET_MOVIE_RATINGS_URI, MOVIE_RATINGS_JSON);
            TraktResponse <ITraktRating> response = await client.Movies.GetMovieRatingsAsync(MOVIE_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull();

            ITraktRating responseValue = response.Value;

            responseValue.Rating.Should().Be(8.31325f);
            responseValue.Votes.Should().Be(10359);

            var distribution = new Dictionary <string, int>()
            {
                { "1", 185 }, { "2", 28 }, { "3", 34 }, { "4", 89 }, { "5", 184 },
                { "6", 630 }, { "7", 1244 }, { "8", 2509 }, { "9", 2622 }, { "10", 2834 }
            };

            responseValue.Distribution.Should().HaveCount(10).And.Contain(distribution);
        }
        public async Task Test_TraktShowsModule_GetShowRatings()
        {
            TraktClient client = TestUtility.GetMockClient(GET_SHOW_RATINGS_URI, SHOW_RATINGS_JSON);
            TraktResponse <ITraktRating> response = await client.Shows.GetShowRatingsAsync(SHOW_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull();

            ITraktRating responseValue = response.Value;

            responseValue.Rating.Should().Be(9.38231f);
            responseValue.Votes.Should().Be(44590);

            IDictionary <string, int> distribution = new Dictionary <string, int>()
            {
                { "1", 258 }, { "2", 57 }, { "3", 59 }, { "4", 116 }, { "5", 262 },
                { "6", 448 }, { "7", 1427 }, { "8", 3893 }, { "9", 8467 }, { "10", 29590 }
            };

            responseValue.Distribution.Should().HaveCount(10).And.Contain(distribution);
        }
Esempio n. 3
0
        public async Task Test_TraktEpisodesModule_GetEpisodeRatings()
        {
            TraktClient client = TestUtility.GetMockClient(GET_EPISODE_RATINGS_URI, EPISODE_RATINGS_JSON);
            TraktResponse <ITraktRating> response = await client.Episodes.GetEpisodeRatingsAsync(SHOW_ID, SEASON_NR, EPISODE_NR);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull();

            ITraktRating responseValue = response.Value;

            responseValue.Rating.Should().Be(8.54044f);
            responseValue.Votes.Should().Be(3919);

            var distribution = new Dictionary <string, int>()
            {
                { "1", 59 }, { "2", 11 }, { "3", 2 }, { "4", 14 }, { "5", 58 },
                { "6", 233 }, { "7", 492 }, { "8", 835 }, { "9", 635 }, { "10", 1580 }
            };

            responseValue.Distribution.Should().HaveCount(10).And.Contain(distribution);
        }
        public async Task Test_TraktSeasonsModule_GetSeasonRatings()
        {
            TraktClient client = TestUtility.GetMockClient(GET_SEASON_RATINGS_URI, SEASON_RATINGS_JSON);
            TraktResponse <ITraktRating> response = await client.Seasons.GetSeasonRatingsAsync(SHOW_ID, SEASON_NR);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull();

            ITraktRating responseValue = response.Value;

            responseValue.Rating.Should().Be(9.12881f);
            responseValue.Votes.Should().Be(1149);

            var distribution = new Dictionary <string, int>()
            {
                { "1", 7 }, { "2", 5 }, { "3", 4 }, { "4", 2 }, { "5", 9 },
                { "6", 23 }, { "7", 45 }, { "8", 152 }, { "9", 282 }, { "10", 620 }
            };

            responseValue.Distribution.Should().HaveCount(10).And.Contain(distribution);
        }