コード例 #1
0
        public void Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();
            Func <Task <ITraktSyncShowsLastActivities> > showsLastActivities = () => jsonReader.ReadObjectAsync(default(Stream));

            showsLastActivities.Should().Throw <ArgumentNullException>();
        }
コード例 #2
0
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Empty()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

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

            showsLastActivities.Should().BeNull();
        }
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Null()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

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

            showsLastActivities.Should().BeNull();
        }
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Null()
        {
            var traktJsonReader = new SyncShowsLastActivitiesObjectJsonReader();

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

            showsLastActivities.Should().BeNull();
        }
コード例 #5
0
        public async Task Test_TraktSyncShowsLastActivities_From_Json()
        {
            var jsonReader          = new SyncShowsLastActivitiesObjectJsonReader();
            var showsLastActivities = await jsonReader.ReadObjectAsync(JSON) as TraktSyncShowsLastActivities;

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

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

                showsLastActivities.Should().BeNull();
            }
        }
コード例 #7
0
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Incomplete_6()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

            var showsLastActivities = await jsonReader.ReadObjectAsync(JSON_INCOMPLETE_6);

            showsLastActivities.Should().NotBeNull();
            showsLastActivities.RatedAt.Should().BeNull();
            showsLastActivities.WatchlistedAt.Should().Be(DateTime.Parse("2014-11-19T22:02:41.308Z").ToUniversalTime());
            showsLastActivities.CommentedAt.Should().BeNull();
            showsLastActivities.HiddenAt.Should().BeNull();
        }
コード例 #8
0
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Not_Valid_5()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

            var showsLastActivities = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_5);

            showsLastActivities.Should().NotBeNull();
            showsLastActivities.RatedAt.Should().BeNull();
            showsLastActivities.WatchlistedAt.Should().BeNull();
            showsLastActivities.CommentedAt.Should().BeNull();
            showsLastActivities.HiddenAt.Should().BeNull();
        }
コード例 #9
0
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Not_Valid_2()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

            var showsLastActivities = await jsonReader.ReadObjectAsync(JSON_NOT_VALID_2);

            showsLastActivities.Should().NotBeNull();
            showsLastActivities.RatedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.305Z").ToUniversalTime());
            showsLastActivities.WatchlistedAt.Should().BeNull();
            showsLastActivities.CommentedAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
            showsLastActivities.HiddenAt.Should().Be(DateTime.Parse("2014-11-20T06:51:30.325Z").ToUniversalTime());
        }
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_JsonReader_Empty()
        {
            var traktJsonReader = new SyncShowsLastActivitiesObjectJsonReader();

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

                    showsLastActivities.Should().BeNull();
                }
        }
        public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Stream_Incomplete_4()
        {
            var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();

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

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

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

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

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

                    showsLastActivities.Should().NotBeNull();
                    showsLastActivities.RatedAt.Should().BeNull();
                    showsLastActivities.WatchlistedAt.Should().BeNull();
                    showsLastActivities.CommentedAt.Should().BeNull();
                    showsLastActivities.HiddenAt.Should().BeNull();
                }
        }
コード例 #14
0
 public async Task Test_SyncShowsLastActivitiesObjectJsonReader_ReadObject_From_Json_String_Null()
 {
     var jsonReader = new SyncShowsLastActivitiesObjectJsonReader();
     Func <Task <ITraktSyncShowsLastActivities> > showsLastActivities = () => jsonReader.ReadObjectAsync(default(string));
     await showsLastActivities.Should().ThrowAsync <ArgumentNullException>();
 }