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

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

                    traktSeasonCollectionProgress.Should().NotBeNull();
                    traktSeasonCollectionProgress.Number.Should().Be(2);
                    traktSeasonCollectionProgress.Aired.Should().BeNull();
                    traktSeasonCollectionProgress.Completed.Should().Be(2);
                    traktSeasonCollectionProgress.Episodes.Should().NotBeNull().And.HaveCount(2);

                    var episodesCollectionProgress = traktSeasonCollectionProgress.Episodes.ToArray();

                    episodesCollectionProgress[0].Should().NotBeNull();
                    episodesCollectionProgress[0].Number.Should().Be(1);
                    episodesCollectionProgress[0].Completed.Should().BeTrue();
                    episodesCollectionProgress[0].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

                    episodesCollectionProgress[1].Should().NotBeNull();
                    episodesCollectionProgress[1].Number.Should().Be(2);
                    episodesCollectionProgress[1].Completed.Should().BeTrue();
                    episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());
                }
        }
        public void Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new SeasonCollectionProgressObjectJsonReader();
            Func <Task <ITraktSeasonCollectionProgress> > traktSeasonCollectionProgress = () => jsonReader.ReadObjectAsync(default(string));

            traktSeasonCollectionProgress.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Stream_Not_Valid_3()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

            using (var stream = JSON_NOT_VALID_3.ToStream())
            {
                var traktSeasonCollectionProgress = await traktJsonReader.ReadObjectAsync(stream);

                traktSeasonCollectionProgress.Should().NotBeNull();
                traktSeasonCollectionProgress.Number.Should().Be(2);
                traktSeasonCollectionProgress.Aired.Should().Be(3);
                traktSeasonCollectionProgress.Completed.Should().BeNull();
                traktSeasonCollectionProgress.Episodes.Should().NotBeNull().And.HaveCount(2);

                var episodesCollectionProgress = traktSeasonCollectionProgress.Episodes.ToArray();

                episodesCollectionProgress[0].Should().NotBeNull();
                episodesCollectionProgress[0].Number.Should().Be(1);
                episodesCollectionProgress[0].Completed.Should().BeTrue();
                episodesCollectionProgress[0].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

                episodesCollectionProgress[1].Should().NotBeNull();
                episodesCollectionProgress[1].Number.Should().Be(2);
                episodesCollectionProgress[1].Completed.Should().BeTrue();
                episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());
            }
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new SeasonCollectionProgressObjectJsonReader();

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

            traktSeasonCollectionProgress.Should().BeNull();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

            var traktSeasonCollectionProgress = await traktJsonReader.ReadObjectAsync(default(Stream));

            traktSeasonCollectionProgress.Should().BeNull();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

            using (var stream = string.Empty.ToStream())
            {
                var traktSeasonCollectionProgress = await traktJsonReader.ReadObjectAsync(stream);

                traktSeasonCollectionProgress.Should().BeNull();
            }
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new SeasonCollectionProgressObjectJsonReader();

            var traktSeasonCollectionProgress = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            traktSeasonCollectionProgress.Should().NotBeNull();
            traktSeasonCollectionProgress.Number.Should().BeNull();
            traktSeasonCollectionProgress.Aired.Should().BeNull();
            traktSeasonCollectionProgress.Completed.Should().BeNull();
            traktSeasonCollectionProgress.Episodes.Should().BeNull();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Json_String_Incomplete_7()
        {
            var jsonReader = new SeasonCollectionProgressObjectJsonReader();

            var traktSeasonCollectionProgress = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_7);

            traktSeasonCollectionProgress.Should().NotBeNull();
            traktSeasonCollectionProgress.Number.Should().BeNull();
            traktSeasonCollectionProgress.Aired.Should().BeNull();
            traktSeasonCollectionProgress.Completed.Should().Be(2);
            traktSeasonCollectionProgress.Episodes.Should().BeNull();
        }
Пример #9
0
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

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

                    traktSeasonCollectionProgress.Should().BeNull();
                }
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Stream_Not_Valid_5()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

            using (var stream = JSON_NOT_VALID_5.ToStream())
            {
                var traktSeasonCollectionProgress = await traktJsonReader.ReadObjectAsync(stream);

                traktSeasonCollectionProgress.Should().NotBeNull();
                traktSeasonCollectionProgress.Number.Should().BeNull();
                traktSeasonCollectionProgress.Aired.Should().BeNull();
                traktSeasonCollectionProgress.Completed.Should().BeNull();
                traktSeasonCollectionProgress.Episodes.Should().BeNull();
            }
        }
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_Stream_Incomplete_7()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_7.ToStream())
            {
                var traktSeasonCollectionProgress = await traktJsonReader.ReadObjectAsync(stream);

                traktSeasonCollectionProgress.Should().NotBeNull();
                traktSeasonCollectionProgress.Number.Should().BeNull();
                traktSeasonCollectionProgress.Aired.Should().BeNull();
                traktSeasonCollectionProgress.Completed.Should().Be(2);
                traktSeasonCollectionProgress.Episodes.Should().BeNull();
            }
        }
Пример #12
0
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

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

                    traktSeasonCollectionProgress.Should().NotBeNull();
                    traktSeasonCollectionProgress.Number.Should().BeNull();
                    traktSeasonCollectionProgress.Aired.Should().BeNull();
                    traktSeasonCollectionProgress.Completed.Should().BeNull();
                    traktSeasonCollectionProgress.Episodes.Should().BeNull();
                }
        }
Пример #13
0
        public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_JsonReader_Incomplete_6()
        {
            var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();

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

                    traktSeasonCollectionProgress.Should().NotBeNull();
                    traktSeasonCollectionProgress.Number.Should().BeNull();
                    traktSeasonCollectionProgress.Aired.Should().Be(3);
                    traktSeasonCollectionProgress.Completed.Should().BeNull();
                    traktSeasonCollectionProgress.Episodes.Should().BeNull();
                }
        }
        public async Task Test_TraktSeasonCollectionProgress_From_Json()
        {
            var jsonReader = new SeasonCollectionProgressObjectJsonReader();
            var seasonCollectionProgress = await jsonReader.ReadObjectAsync(JSON) as TraktSeasonCollectionProgress;

            seasonCollectionProgress.Should().NotBeNull();
            seasonCollectionProgress.Number.Should().Be(2);
            seasonCollectionProgress.Aired.Should().Be(3);
            seasonCollectionProgress.Completed.Should().Be(2);
            seasonCollectionProgress.Episodes.Should().NotBeNull().And.HaveCount(2);

            var episodesCollectionProgress = seasonCollectionProgress.Episodes.ToArray();

            episodesCollectionProgress[0].Should().NotBeNull();
            episodesCollectionProgress[0].Number.Should().Be(1);
            episodesCollectionProgress[0].Completed.Should().BeTrue();
            episodesCollectionProgress[0].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime());

            episodesCollectionProgress[1].Should().NotBeNull();
            episodesCollectionProgress[1].Number.Should().Be(2);
            episodesCollectionProgress[1].Completed.Should().BeTrue();
            episodesCollectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime());
        }
Пример #15
0
 public async Task Test_SeasonCollectionProgressObjectJsonReader_ReadObject_From_JsonReader_Null()
 {
     var traktJsonReader = new SeasonCollectionProgressObjectJsonReader();
     Func <Task <ITraktSeasonCollectionProgress> > traktSeasonCollectionProgress = () => traktJsonReader.ReadObjectAsync(default(JsonTextReader));
     await traktSeasonCollectionProgress.Should().ThrowAsync <ArgumentNullException>();
 }