Example #1
0
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Not_Valid_4()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            using (var stream = JSON_NOT_VALID_4.ToStream())
            {
                var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(stream);

                traktWatchedShowEpisodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3);

                var watchedShowEpisodes = traktWatchedShowEpisodes.ToArray();

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

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

                watchedShowEpisodes[2].Should().NotBeNull();
                watchedShowEpisodes[2].Number.Should().Be(3);
                watchedShowEpisodes[2].Plays.Should().Be(1);
                watchedShowEpisodes[2].LastWatchedAt.Should().BeNull();
            }
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Json_String_Incomplete_2()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(JSON_INCOMPLETE_2);

            traktWatchedShowEpisodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3);

            var watchedShowEpisodes = traktWatchedShowEpisodes.ToArray();

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

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

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

            var traktEpisodeWatchedProgress = await jsonReader.ReadArrayAsync(string.Empty);

            traktEpisodeWatchedProgress.Should().BeNull();
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Json_String_Empty_Array()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(JSON_EMPTY_ARRAY);

            traktWatchedShowEpisodes.Should().NotBeNull().And.BeEmpty();
        }
Example #5
0
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Null()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            var traktEpisodeWatchedProgress = await jsonReader.ReadArrayAsync(default(Stream));

            traktEpisodeWatchedProgress.Should().BeNull();
        }
Example #6
0
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Empty()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktEpisodeWatchedProgress = await jsonReader.ReadArrayAsync(stream);

                traktEpisodeWatchedProgress.Should().BeNull();
            }
        }
Example #7
0
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Empty_Array()
        {
            var jsonReader = new WatchedShowEpisodeArrayJsonReader();

            using (var stream = JSON_EMPTY_ARRAY.ToStream())
            {
                var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(stream);

                traktWatchedShowEpisodes.Should().NotBeNull().And.BeEmpty();
            }
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Empty()
        {
            var traktJsonReader = new WatchedShowEpisodeArrayJsonReader();

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

                    traktEpisodeWatchedProgress.Should().BeNull();
                }
        }
        public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Empty_Array()
        {
            var traktJsonReader = new WatchedShowEpisodeArrayJsonReader();

            using (var reader = new StringReader(JSON_EMPTY_ARRAY))
                using (var jsonReader = new JsonTextReader(reader))
                {
                    var traktWatchedShowEpisodes = await traktJsonReader.ReadArrayAsync(jsonReader);

                    traktWatchedShowEpisodes.Should().NotBeNull().And.BeEmpty();
                }
        }