Esempio n. 1
0
        public void Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();
            Func <Task <ITraktWatchedShowSeason> > traktWatchedShowSeason = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktWatchedShowSeason.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

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

            traktWatchedShowSeason.Should().BeNull();
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();

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

            traktWatchedShowSeason.Should().BeNull();
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

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

            traktWatchedShowSeason.Should().BeNull();
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            traktWatchedShowSeason.Should().NotBeNull();
            traktWatchedShowSeason.Number.Should().Be(1);
            traktWatchedShowSeason.Episodes.Should().BeNull();
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

            traktWatchedShowSeason.Should().NotBeNull();
            traktWatchedShowSeason.Number.Should().Be(1);
            traktWatchedShowSeason.Episodes.Should().BeNull();
        }
Esempio n. 7
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

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

                traktWatchedShowSeason.Should().BeNull();
            }
        }
Esempio n. 8
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();

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

                    traktWatchedShowSeason.Should().BeNull();
                }
        }
Esempio n. 9
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(stream);

                traktWatchedShowSeason.Should().NotBeNull();
                traktWatchedShowSeason.Number.Should().BeNull();
                traktWatchedShowSeason.Episodes.Should().BeNull();
            }
        }
Esempio n. 10
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_2.ToStream())
            {
                var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(stream);

                traktWatchedShowSeason.Should().NotBeNull();
                traktWatchedShowSeason.Number.Should().Be(1);
                traktWatchedShowSeason.Episodes.Should().BeNull();
            }
        }
Esempio n. 11
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();

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

                    traktWatchedShowSeason.Should().NotBeNull();
                    traktWatchedShowSeason.Number.Should().Be(1);
                    traktWatchedShowSeason.Episodes.Should().BeNull();
                }
        }
Esempio n. 12
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();

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

                    traktWatchedShowSeason.Should().NotBeNull();
                    traktWatchedShowSeason.Number.Should().BeNull();
                    traktWatchedShowSeason.Episodes.Should().BeNull();
                }
        }
Esempio n. 13
0
        public async Task Test_TraktWatchedShowSeason_From_Json()
        {
            var jsonReader        = new WatchedShowSeasonObjectJsonReader();
            var watchedShowSeason = await jsonReader.ReadObjectAsync(JSON) as TraktWatchedShowSeason;

            watchedShowSeason.Should().NotBeNull();
            watchedShowSeason.Number.Should().Be(1);

            watchedShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
            var episodes = watchedShowSeason.Episodes.ToArray();

            episodes[0].Number.Should().Be(1);
            episodes[0].Plays.Should().Be(1);
            episodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

            episodes[1].Number.Should().Be(2);
            episodes[1].Plays.Should().Be(1);
            episodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());
        }
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Json_String_Not_Valid_1()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_1);

            traktWatchedShowSeason.Should().NotBeNull();
            traktWatchedShowSeason.Number.Should().BeNull();

            traktWatchedShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
            var traktWatchedShowSeasonEpisodes = traktWatchedShowSeason.Episodes.ToArray();

            traktWatchedShowSeasonEpisodes[0].Number.Should().Be(1);
            traktWatchedShowSeasonEpisodes[0].Plays.Should().Be(1);
            traktWatchedShowSeasonEpisodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

            traktWatchedShowSeasonEpisodes[1].Number.Should().Be(2);
            traktWatchedShowSeasonEpisodes[1].Plays.Should().Be(1);
            traktWatchedShowSeasonEpisodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());
        }
Esempio n. 15
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new WatchedShowSeasonObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_1.ToStream())
            {
                var traktWatchedShowSeason = await jsonReader.ReadObjectAsync(stream);

                traktWatchedShowSeason.Should().NotBeNull();
                traktWatchedShowSeason.Number.Should().BeNull();

                traktWatchedShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                var traktWatchedShowSeasonEpisodes = traktWatchedShowSeason.Episodes.ToArray();

                traktWatchedShowSeasonEpisodes[0].Number.Should().Be(1);
                traktWatchedShowSeasonEpisodes[0].Plays.Should().Be(1);
                traktWatchedShowSeasonEpisodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

                traktWatchedShowSeasonEpisodes[1].Number.Should().Be(2);
                traktWatchedShowSeasonEpisodes[1].Plays.Should().Be(1);
                traktWatchedShowSeasonEpisodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());
            }
        }
Esempio n. 16
0
        public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Complete()
        {
            var traktJsonReader = new WatchedShowSeasonObjectJsonReader();

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

                    traktWatchedShowSeason.Should().NotBeNull();
                    traktWatchedShowSeason.Number.Should().Be(1);

                    traktWatchedShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                    var traktWatchedShowSeasonEpisodes = traktWatchedShowSeason.Episodes.ToArray();

                    traktWatchedShowSeasonEpisodes[0].Number.Should().Be(1);
                    traktWatchedShowSeasonEpisodes[0].Plays.Should().Be(1);
                    traktWatchedShowSeasonEpisodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());

                    traktWatchedShowSeasonEpisodes[1].Number.Should().Be(2);
                    traktWatchedShowSeasonEpisodes[1].Plays.Should().Be(1);
                    traktWatchedShowSeasonEpisodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime());
                }
        }
Esempio n. 17
0
 public async Task Test_WatchedShowSeasonObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new WatchedShowSeasonObjectJsonReader();
     Func <Task <ITraktWatchedShowSeason> > traktWatchedShowSeason = () => jsonReader.ReadObjectAsync(default(Stream));
     await traktWatchedShowSeason.Should().ThrowAsync <ArgumentNullException>();
 }