예제 #1
0
        public void Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Exceptions()
        {
            var traktJsonWriter          = new EpisodeCollectionProgressObjectJsonWriter();
            Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(ITraktEpisodeCollectionProgress));

            action.Should().Throw <ArgumentNullException>();
        }
예제 #2
0
 public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Exceptions()
 {
     var traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
     ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress();
     Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktEpisodeCollectionProgress);
     await action.Should().ThrowAsync <ArgumentNullException>();
 }
예제 #3
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Only_CollectedAt_Property()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                CollectedAt = COLLECTED_AT
            };

            var    traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktEpisodeCollectionProgress);

            json.Should().Be($"{{\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}");
        }
예제 #4
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Only_Completed_Property()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                Completed = true
            };

            var    traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktEpisodeCollectionProgress);

            json.Should().Be(@"{""completed"":true}");
        }
예제 #5
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Only_Number_Property()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                Number = 1
            };

            var    traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktEpisodeCollectionProgress);

            json.Should().Be(@"{""number"":1}");
        }
예제 #6
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Complete()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                Number      = 1,
                Completed   = true,
                CollectedAt = COLLECTED_AT
            };

            var    traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktEpisodeCollectionProgress);

            json.Should().Be(@"{""number"":1,""completed"":true," +
                             $"\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}");
        }
예제 #7
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Only_CollectedAt_Property()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                CollectedAt = COLLECTED_AT
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeCollectionProgress);

                    stringWriter.ToString().Should().Be($"{{\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}");
                }
        }
예제 #8
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Only_Completed_Property()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                Completed = true
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeCollectionProgress);

                    stringWriter.ToString().Should().Be(@"{""completed"":true}");
                }
        }
예제 #9
0
        public async Task Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Complete()
        {
            ITraktEpisodeCollectionProgress traktEpisodeCollectionProgress = new TraktEpisodeCollectionProgress
            {
                Number      = 1,
                Completed   = true,
                CollectedAt = COLLECTED_AT
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeCollectionProgress);

                    stringWriter.ToString().Should().Be(@"{""number"":1,""completed"":true," +
                                                        $"\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}");
                }
        }