Пример #1
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_1()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();

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

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

                    traktCollectionShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                    var traktCollectionShowSeasonEpisodes = traktCollectionShowSeason.Episodes.ToArray();

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

                    traktCollectionShowSeasonEpisodes[1].Number.Should().Be(2);
                    traktCollectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
                    traktCollectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull();
                    traktCollectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                    traktCollectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                    traktCollectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                    traktCollectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                    traktCollectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();
                }
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Incomplete_1()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

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

                traktCollectionShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
                var traktCollectionShowSeasonEpisodes = traktCollectionShowSeason.Episodes.ToArray();

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

                traktCollectionShowSeasonEpisodes[1].Number.Should().Be(2);
                traktCollectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
                traktCollectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull();
                traktCollectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
                traktCollectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
                traktCollectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
                traktCollectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
                traktCollectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();
            }
        }
Пример #3
0
        public async Task Test_TraktCollectionShowSeason_From_Json()
        {
            var jsonReader           = new CollectionShowSeasonObjectJsonReader();
            var collectionShowSeason = await jsonReader.ReadObjectAsync(JSON) as TraktCollectionShowSeason;

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

            collectionShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2);
            var collectionShowSeasonEpisodes = collectionShowSeason.Episodes.ToArray();

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

            collectionShowSeasonEpisodes[1].Number.Should().Be(2);
            collectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime());
            collectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull();
            collectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital);
            collectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p);
            collectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC);
            collectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1);
            collectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse();
        }
Пример #4
0
        public void Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();
            Func <Task <ITraktCollectionShowSeason> > traktCollectionShowSeason = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));

            traktCollectionShowSeason.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

            traktCollectionShowSeason.Should().BeNull();
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();

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

            traktCollectionShowSeason.Should().BeNull();
        }
Пример #7
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

            traktCollectionShowSeason.Should().BeNull();
        }
Пример #8
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Json_String_Not_Valid_3()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

            var traktCollectionShowSeason = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_3);

            traktCollectionShowSeason.Should().NotBeNull();
            traktCollectionShowSeason.Number.Should().BeNull();
            traktCollectionShowSeason.Episodes.Should().BeNull();
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

                traktCollectionShowSeason.Should().BeNull();
            }
        }
Пример #10
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Json_String_Incomplete_2()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

            var traktCollectionShowSeason = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_2);

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

            traktCollectionShowSeason.Episodes.Should().BeNull();
        }
Пример #11
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();

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

                    traktCollectionShowSeason.Should().BeNull();
                }
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

                traktCollectionShowSeason.Should().NotBeNull();
                traktCollectionShowSeason.Number.Should().BeNull();
                traktCollectionShowSeason.Episodes.Should().BeNull();
            }
        }
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Incomplete_2()
        {
            var jsonReader = new CollectionShowSeasonObjectJsonReader();

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

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

                traktCollectionShowSeason.Episodes.Should().BeNull();
            }
        }
Пример #14
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_3()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();

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

                    traktCollectionShowSeason.Should().NotBeNull();
                    traktCollectionShowSeason.Number.Should().BeNull();
                    traktCollectionShowSeason.Episodes.Should().BeNull();
                }
        }
Пример #15
0
        public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_JsonReader_Incomplete_2()
        {
            var traktJsonReader = new CollectionShowSeasonObjectJsonReader();

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

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

                    traktCollectionShowSeason.Episodes.Should().BeNull();
                }
        }
Пример #16
0
 public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new CollectionShowSeasonObjectJsonReader();
     Func <Task <ITraktCollectionShowSeason> > traktCollectionShowSeason = () => jsonReader.ReadObjectAsync(default(string));
     await traktCollectionShowSeason.Should().ThrowAsync <ArgumentNullException>();
 }