Beispiel #1
0
        public void Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Null()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();
            Func <Task <ITraktSyncSeasonsLastActivities> > seasonsLastActivities = () => jsonReader.ReadObjectAsync(default(string));

            seasonsLastActivities.Should().Throw <ArgumentNullException>();
        }
Beispiel #2
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

            seasonsLastActivities.Should().BeNull();
        }
Beispiel #3
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

            seasonsLastActivities.Should().BeNull();
        }
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

            seasonsLastActivities.Should().BeNull();
        }
        public async Task Test_TraktSyncSeasonsLastActivities_From_Json()
        {
            var jsonReader            = new SyncSeasonsLastActivitiesObjectJsonReader();
            var seasonsLastActivities = await jsonReader.ReadObjectAsync(JSON) as TraktSyncSeasonsLastActivities;

            seasonsLastActivities.Should().NotBeNull();
            seasonsLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
            seasonsLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
            seasonsLastActivities.CommentedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
            seasonsLastActivities.HiddenAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
        }
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Empty()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

                seasonsLastActivities.Should().BeNull();
            }
        }
Beispiel #7
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

            var seasonsLastActivities = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            seasonsLastActivities.Should().NotBeNull();
            seasonsLastActivities.RatedAt.Should().BeNull();
            seasonsLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
            seasonsLastActivities.CommentedAt.Should().BeNull();
            seasonsLastActivities.HiddenAt.Should().BeNull();
        }
Beispiel #8
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

            var seasonsLastActivities = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            seasonsLastActivities.Should().NotBeNull();
            seasonsLastActivities.RatedAt.Should().BeNull();
            seasonsLastActivities.WatchlistedAt.Should().BeNull();
            seasonsLastActivities.CommentedAt.Should().BeNull();
            seasonsLastActivities.HiddenAt.Should().BeNull();
        }
Beispiel #9
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

            var seasonsLastActivities = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            seasonsLastActivities.Should().NotBeNull();
            seasonsLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
            seasonsLastActivities.WatchlistedAt.Should().BeNull();
            seasonsLastActivities.CommentedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
            seasonsLastActivities.HiddenAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
        }
Beispiel #10
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

                    seasonsLastActivities.Should().BeNull();
                }
        }
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

            using (var stream = JSON_INCOMPLETE_4.ToStream())
            {
                var seasonsLastActivities = await jsonReader.ReadObjectAsync(stream);

                seasonsLastActivities.Should().NotBeNull();
                seasonsLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
                seasonsLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
                seasonsLastActivities.CommentedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
                seasonsLastActivities.HiddenAt.Should().BeNull();
            }
        }
Beispiel #12
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Incomplete_3()
        {
            var traktJsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

                    seasonsLastActivities.Should().NotBeNull();
                    seasonsLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
                    seasonsLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
                    seasonsLastActivities.CommentedAt.Should().BeNull();
                    seasonsLastActivities.HiddenAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
                }
        }
Beispiel #13
0
        public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Not_Valid_5()
        {
            var traktJsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();

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

                    seasonsLastActivities.Should().NotBeNull();
                    seasonsLastActivities.RatedAt.Should().BeNull();
                    seasonsLastActivities.WatchlistedAt.Should().BeNull();
                    seasonsLastActivities.CommentedAt.Should().BeNull();
                    seasonsLastActivities.HiddenAt.Should().BeNull();
                }
        }
 public async Task Test_SyncSeasonsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Null()
 {
     var jsonReader = new SyncSeasonsLastActivitiesObjectJsonReader();
     Func <Task <ITraktSyncSeasonsLastActivities> > seasonsLastActivities = () => jsonReader.ReadObjectAsync(default(Stream));
     await seasonsLastActivities.Should().ThrowAsync <ArgumentNullException>();
 }