public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Incomplete_10()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_10.ToStream())
            {
                var userStatistics = await jsonReader.ReadObjectAsync(stream);

                userStatistics.Should().NotBeNull();

                userStatistics.Movies.Should().BeNull();
                userStatistics.Shows.Should().BeNull();
                userStatistics.Seasons.Should().BeNull();

                userStatistics.Episodes.Should().NotBeNull();
                userStatistics.Episodes.Plays.Should().Be(552);
                userStatistics.Episodes.Watched.Should().Be(534);
                userStatistics.Episodes.Minutes.Should().Be(17330);
                userStatistics.Episodes.Collected.Should().Be(117);
                userStatistics.Episodes.Ratings.Should().Be(64);
                userStatistics.Episodes.Comments.Should().Be(14);

                userStatistics.Network.Should().BeNull();
                userStatistics.Ratings.Should().BeNull();
            }
        }
Exemple #2
0
        public void Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();
            Func <Task <ITraktUserStatistics> > userStatistics = () => jsonReader.ReadObjectAsync(default(string));

            userStatistics.Should().Throw <ArgumentNullException>();
        }
Exemple #3
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Incomplete_12()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_12);

            userStatistics.Should().NotBeNull();

            userStatistics.Movies.Should().BeNull();
            userStatistics.Shows.Should().BeNull();
            userStatistics.Seasons.Should().BeNull();
            userStatistics.Episodes.Should().BeNull();
            userStatistics.Network.Should().BeNull();

            userStatistics.Ratings.Should().NotBeNull();
            userStatistics.Ratings.Total.Should().Be(9257);
            userStatistics.Ratings.Distribution.Should().NotBeNull();
            userStatistics.Ratings.Distribution.Should().NotBeEmpty();
            userStatistics.Ratings.Distribution.Should().HaveCount(10);
            userStatistics.Ratings.Distribution.Should().Contain(new Dictionary <string, int>
            {
                ["1"]  = 78,
                ["2"]  = 45,
                ["3"]  = 55,
                ["4"]  = 96,
                ["5"]  = 183,
                ["6"]  = 545,
                ["7"]  = 1361,
                ["8"]  = 2259,
                ["9"]  = 1772,
                ["10"] = 2863
            });
        }
Exemple #4
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(JSON_NOT_VALID_3))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().NotBeNull();

                    userStatistics.Movies.Should().NotBeNull();
                    userStatistics.Movies.Plays.Should().Be(552);
                    userStatistics.Movies.Watched.Should().Be(534);
                    userStatistics.Movies.Minutes.Should().Be(17330);
                    userStatistics.Movies.Collected.Should().Be(117);
                    userStatistics.Movies.Ratings.Should().Be(64);
                    userStatistics.Movies.Comments.Should().Be(14);

                    userStatistics.Shows.Should().NotBeNull();
                    userStatistics.Shows.Watched.Should().Be(534);
                    userStatistics.Shows.Collected.Should().Be(117);
                    userStatistics.Shows.Ratings.Should().Be(64);
                    userStatistics.Shows.Comments.Should().Be(14);

                    userStatistics.Seasons.Should().BeNull();

                    userStatistics.Episodes.Should().NotBeNull();
                    userStatistics.Episodes.Plays.Should().Be(552);
                    userStatistics.Episodes.Watched.Should().Be(534);
                    userStatistics.Episodes.Minutes.Should().Be(17330);
                    userStatistics.Episodes.Collected.Should().Be(117);
                    userStatistics.Episodes.Ratings.Should().Be(64);
                    userStatistics.Episodes.Comments.Should().Be(14);

                    userStatistics.Network.Should().NotBeNull();
                    userStatistics.Network.Friends.Should().Be(1);
                    userStatistics.Network.Followers.Should().Be(4);
                    userStatistics.Network.Following.Should().Be(11);

                    userStatistics.Ratings.Should().NotBeNull();
                    userStatistics.Ratings.Total.Should().Be(9257);
                    userStatistics.Ratings.Distribution.Should().NotBeNull();
                    userStatistics.Ratings.Distribution.Should().NotBeEmpty();
                    userStatistics.Ratings.Distribution.Should().HaveCount(10);
                    userStatistics.Ratings.Distribution.Should().Contain(new Dictionary <string, int>
                    {
                        ["1"]  = 78,
                        ["2"]  = 45,
                        ["3"]  = 55,
                        ["4"]  = 96,
                        ["5"]  = 183,
                        ["6"]  = 545,
                        ["7"]  = 1361,
                        ["8"]  = 2259,
                        ["9"]  = 1772,
                        ["10"] = 2863
                    });
                }
        }
Exemple #5
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_10()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(JSON_INCOMPLETE_10))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().NotBeNull();

                    userStatistics.Movies.Should().BeNull();
                    userStatistics.Shows.Should().BeNull();
                    userStatistics.Seasons.Should().BeNull();

                    userStatistics.Episodes.Should().NotBeNull();
                    userStatistics.Episodes.Plays.Should().Be(552);
                    userStatistics.Episodes.Watched.Should().Be(534);
                    userStatistics.Episodes.Minutes.Should().Be(17330);
                    userStatistics.Episodes.Collected.Should().Be(117);
                    userStatistics.Episodes.Ratings.Should().Be(64);
                    userStatistics.Episodes.Comments.Should().Be(14);

                    userStatistics.Network.Should().BeNull();
                    userStatistics.Ratings.Should().BeNull();
                }
        }
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Incomplete_3()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_3.ToStream())
            {
                var userStatistics = await jsonReader.ReadObjectAsync(stream);

                userStatistics.Should().NotBeNull();

                userStatistics.Movies.Should().NotBeNull();
                userStatistics.Movies.Plays.Should().Be(552);
                userStatistics.Movies.Watched.Should().Be(534);
                userStatistics.Movies.Minutes.Should().Be(17330);
                userStatistics.Movies.Collected.Should().Be(117);
                userStatistics.Movies.Ratings.Should().Be(64);
                userStatistics.Movies.Comments.Should().Be(14);

                userStatistics.Shows.Should().NotBeNull();
                userStatistics.Shows.Watched.Should().Be(534);
                userStatistics.Shows.Collected.Should().Be(117);
                userStatistics.Shows.Ratings.Should().Be(64);
                userStatistics.Shows.Comments.Should().Be(14);

                userStatistics.Seasons.Should().BeNull();

                userStatistics.Episodes.Should().NotBeNull();
                userStatistics.Episodes.Plays.Should().Be(552);
                userStatistics.Episodes.Watched.Should().Be(534);
                userStatistics.Episodes.Minutes.Should().Be(17330);
                userStatistics.Episodes.Collected.Should().Be(117);
                userStatistics.Episodes.Ratings.Should().Be(64);
                userStatistics.Episodes.Comments.Should().Be(14);

                userStatistics.Network.Should().NotBeNull();
                userStatistics.Network.Friends.Should().Be(1);
                userStatistics.Network.Followers.Should().Be(4);
                userStatistics.Network.Following.Should().Be(11);

                userStatistics.Ratings.Should().NotBeNull();
                userStatistics.Ratings.Total.Should().Be(9257);
                userStatistics.Ratings.Distribution.Should().NotBeNull();
                userStatistics.Ratings.Distribution.Should().NotBeEmpty();
                userStatistics.Ratings.Distribution.Should().HaveCount(10);
                userStatistics.Ratings.Distribution.Should().Contain(new Dictionary <string, int>
                {
                    ["1"]  = 78,
                    ["2"]  = 45,
                    ["3"]  = 55,
                    ["4"]  = 96,
                    ["5"]  = 183,
                    ["6"]  = 545,
                    ["7"]  = 1361,
                    ["8"]  = 2259,
                    ["9"]  = 1772,
                    ["10"] = 2863
                });
            }
        }
Exemple #7
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(string.Empty);

            userStatistics.Should().BeNull();
        }
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(default(Stream));

            userStatistics.Should().BeNull();
        }
Exemple #9
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            userStatistics.Should().BeNull();
        }
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var userStatistics = await jsonReader.ReadObjectAsync(stream);

                userStatistics.Should().BeNull();
            }
        }
Exemple #11
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(string.Empty))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().BeNull();
                }
        }
Exemple #12
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Not_Valid_7()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_7);

            userStatistics.Should().NotBeNull();

            userStatistics.Movies.Should().BeNull();
            userStatistics.Shows.Should().BeNull();
            userStatistics.Seasons.Should().BeNull();
            userStatistics.Episodes.Should().BeNull();
            userStatistics.Network.Should().BeNull();
            userStatistics.Ratings.Should().BeNull();
        }
Exemple #13
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_6()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(JSON_NOT_VALID_6))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().NotBeNull();

                    userStatistics.Movies.Should().NotBeNull();
                    userStatistics.Movies.Plays.Should().Be(552);
                    userStatistics.Movies.Watched.Should().Be(534);
                    userStatistics.Movies.Minutes.Should().Be(17330);
                    userStatistics.Movies.Collected.Should().Be(117);
                    userStatistics.Movies.Ratings.Should().Be(64);
                    userStatistics.Movies.Comments.Should().Be(14);

                    userStatistics.Shows.Should().NotBeNull();
                    userStatistics.Shows.Watched.Should().Be(534);
                    userStatistics.Shows.Collected.Should().Be(117);
                    userStatistics.Shows.Ratings.Should().Be(64);
                    userStatistics.Shows.Comments.Should().Be(14);

                    userStatistics.Seasons.Should().NotBeNull();
                    userStatistics.Seasons.Ratings.Should().Be(6);
                    userStatistics.Seasons.Comments.Should().Be(1);

                    userStatistics.Episodes.Should().NotBeNull();
                    userStatistics.Episodes.Plays.Should().Be(552);
                    userStatistics.Episodes.Watched.Should().Be(534);
                    userStatistics.Episodes.Minutes.Should().Be(17330);
                    userStatistics.Episodes.Collected.Should().Be(117);
                    userStatistics.Episodes.Ratings.Should().Be(64);
                    userStatistics.Episodes.Comments.Should().Be(14);

                    userStatistics.Network.Should().NotBeNull();
                    userStatistics.Network.Friends.Should().Be(1);
                    userStatistics.Network.Followers.Should().Be(4);
                    userStatistics.Network.Following.Should().Be(11);

                    userStatistics.Ratings.Should().BeNull();
                }
        }
Exemple #14
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_7()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(JSON_NOT_VALID_7))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().NotBeNull();

                    userStatistics.Movies.Should().BeNull();
                    userStatistics.Shows.Should().BeNull();
                    userStatistics.Seasons.Should().BeNull();
                    userStatistics.Episodes.Should().BeNull();
                    userStatistics.Network.Should().BeNull();
                    userStatistics.Ratings.Should().BeNull();
                }
        }
Exemple #15
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Incomplete_9()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_9);

            userStatistics.Should().NotBeNull();

            userStatistics.Movies.Should().BeNull();
            userStatistics.Shows.Should().BeNull();

            userStatistics.Seasons.Should().NotBeNull();
            userStatistics.Seasons.Ratings.Should().Be(6);
            userStatistics.Seasons.Comments.Should().Be(1);

            userStatistics.Episodes.Should().BeNull();
            userStatistics.Network.Should().BeNull();
            userStatistics.Ratings.Should().BeNull();
        }
Exemple #16
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            var userStatistics = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            userStatistics.Should().NotBeNull();

            userStatistics.Movies.Should().NotBeNull();
            userStatistics.Movies.Plays.Should().Be(552);
            userStatistics.Movies.Watched.Should().Be(534);
            userStatistics.Movies.Minutes.Should().Be(17330);
            userStatistics.Movies.Collected.Should().Be(117);
            userStatistics.Movies.Ratings.Should().Be(64);
            userStatistics.Movies.Comments.Should().Be(14);

            userStatistics.Shows.Should().NotBeNull();
            userStatistics.Shows.Watched.Should().Be(534);
            userStatistics.Shows.Collected.Should().Be(117);
            userStatistics.Shows.Ratings.Should().Be(64);
            userStatistics.Shows.Comments.Should().Be(14);

            userStatistics.Seasons.Should().NotBeNull();
            userStatistics.Seasons.Ratings.Should().Be(6);
            userStatistics.Seasons.Comments.Should().Be(1);

            userStatistics.Episodes.Should().NotBeNull();
            userStatistics.Episodes.Plays.Should().Be(552);
            userStatistics.Episodes.Watched.Should().Be(534);
            userStatistics.Episodes.Minutes.Should().Be(17330);
            userStatistics.Episodes.Collected.Should().Be(117);
            userStatistics.Episodes.Ratings.Should().Be(64);
            userStatistics.Episodes.Comments.Should().Be(14);

            userStatistics.Network.Should().NotBeNull();
            userStatistics.Network.Friends.Should().Be(1);
            userStatistics.Network.Followers.Should().Be(4);
            userStatistics.Network.Following.Should().Be(11);

            userStatistics.Ratings.Should().BeNull();
        }
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Incomplete_11()
        {
            var jsonReader = new UserStatisticsObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_11.ToStream())
            {
                var userStatistics = await jsonReader.ReadObjectAsync(stream);

                userStatistics.Should().NotBeNull();

                userStatistics.Movies.Should().BeNull();
                userStatistics.Shows.Should().BeNull();
                userStatistics.Seasons.Should().BeNull();
                userStatistics.Episodes.Should().BeNull();

                userStatistics.Network.Should().NotBeNull();
                userStatistics.Network.Friends.Should().Be(1);
                userStatistics.Network.Followers.Should().Be(4);
                userStatistics.Network.Following.Should().Be(11);

                userStatistics.Ratings.Should().BeNull();
            }
        }
Exemple #18
0
        public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Incomplete_9()
        {
            var traktJsonReader = new UserStatisticsObjectJsonReader();

            using (var reader = new StringReader(JSON_INCOMPLETE_9))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var userStatistics = await traktJsonReader.ReadObjectAsync(jsonReader);

                    userStatistics.Should().NotBeNull();

                    userStatistics.Movies.Should().BeNull();
                    userStatistics.Shows.Should().BeNull();

                    userStatistics.Seasons.Should().NotBeNull();
                    userStatistics.Seasons.Ratings.Should().Be(6);
                    userStatistics.Seasons.Comments.Should().Be(1);

                    userStatistics.Episodes.Should().BeNull();
                    userStatistics.Network.Should().BeNull();
                    userStatistics.Ratings.Should().BeNull();
                }
        }
 public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new UserStatisticsObjectJsonReader();
     Func <Task <ITraktUserStatistics> > userStatistics = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await userStatistics.Should().ThrowAsync <ArgumentNullException>();
 }