Пример #1
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Json_String_Not_Valid_4()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

            var traktCollectionShowEpisodes = await jsonReader.ReadArrayAsync(JSON_NOT_VALID_4);

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

            var collectionShowEpisodes = traktCollectionShowEpisodes.ToArray();

            collectionShowEpisodes[0].Should().NotBeNull();
            collectionShowEpisodes[0].Number.Should().BeNull();
            collectionShowEpisodes[0].CollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());
            collectionShowEpisodes[0].Metadata.Should().NotBeNull();
            collectionShowEpisodes[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
            collectionShowEpisodes[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
            collectionShowEpisodes[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
            collectionShowEpisodes[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
            collectionShowEpisodes[0].Metadata.ThreeDimensional.Should().BeTrue();

            collectionShowEpisodes[1].Should().NotBeNull();
            collectionShowEpisodes[1].Number.Should().Be(2);
            collectionShowEpisodes[1].CollectedAt.Should().BeNull();
            collectionShowEpisodes[1].Metadata.Should().NotBeNull();
            collectionShowEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
            collectionShowEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
            collectionShowEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
            collectionShowEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
            collectionShowEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();

            collectionShowEpisodes[2].Should().NotBeNull();
            collectionShowEpisodes[2].Number.Should().Be(3);
            collectionShowEpisodes[2].CollectedAt.Should().Be(DateTime.Parse("2014-07-16T01:00:00.000Z").ToUniversalTime());
            collectionShowEpisodes[2].Metadata.Should().BeNull();
        }
Пример #2
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Stream_Null()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

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

            traktEpisodeCollectionProgress.Should().BeNull();
        }
Пример #3
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Json_String_Empty()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

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

            traktEpisodeCollectionProgress.Should().BeNull();
        }
Пример #4
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Json_String_Empty_Array()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

            var traktCollectionShowEpisodes = await jsonReader.ReadArrayAsync(JSON_EMPTY_ARRAY);

            traktCollectionShowEpisodes.Should().NotBeNull().And.BeEmpty();
        }
Пример #5
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Stream_Empty()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

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

                traktEpisodeCollectionProgress.Should().BeNull();
            }
        }
Пример #6
0
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_Stream_Empty_Array()
        {
            var jsonReader = new CollectionShowEpisodeArrayJsonReader();

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

                traktCollectionShowEpisodes.Should().NotBeNull().And.BeEmpty();
            }
        }
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Empty()
        {
            var traktJsonReader = new CollectionShowEpisodeArrayJsonReader();

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

                    traktEpisodeCollectionProgress.Should().BeNull();
                }
        }
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Empty_Array()
        {
            var traktJsonReader = new CollectionShowEpisodeArrayJsonReader();

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

                    traktCollectionShowEpisodes.Should().NotBeNull().And.BeEmpty();
                }
        }
        public async Task Test_CollectionShowEpisodeArrayJsonReader_ReadArray_From_JsonReader_Incomplete_1()
        {
            var traktJsonReader = new CollectionShowEpisodeArrayJsonReader();

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

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

                    var collectionShowEpisodes = traktCollectionShowEpisodes.ToArray();

                    collectionShowEpisodes[0].Should().NotBeNull();
                    collectionShowEpisodes[0].Number.Should().BeNull();
                    collectionShowEpisodes[0].CollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime());
                    collectionShowEpisodes[0].Metadata.Should().NotBeNull();
                    collectionShowEpisodes[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                    collectionShowEpisodes[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                    collectionShowEpisodes[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                    collectionShowEpisodes[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                    collectionShowEpisodes[0].Metadata.ThreeDimensional.Should().BeTrue();

                    collectionShowEpisodes[1].Should().NotBeNull();
                    collectionShowEpisodes[1].Number.Should().Be(2);
                    collectionShowEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
                    collectionShowEpisodes[1].Metadata.Should().NotBeNull();
                    collectionShowEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                    collectionShowEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                    collectionShowEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                    collectionShowEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                    collectionShowEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();

                    collectionShowEpisodes[2].Should().NotBeNull();
                    collectionShowEpisodes[2].Number.Should().Be(3);
                    collectionShowEpisodes[2].CollectedAt.Should().Be(DateTime.Parse("2014-07-16T01:00:00.000Z").ToUniversalTime());
                    collectionShowEpisodes[2].Metadata.Should().NotBeNull();
                    collectionShowEpisodes[2].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                    collectionShowEpisodes[2].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                    collectionShowEpisodes[2].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                    collectionShowEpisodes[2].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                    collectionShowEpisodes[2].Metadata.ThreeDimensional.Should().BeTrue();
                }
        }