public void Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_Object_Exceptions()
        {
            var traktJsonWriter          = new SeasonCollectionProgressObjectJsonWriter();
            Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(ITraktSeasonCollectionProgress));

            action.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_Object_Complete()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Number    = 1,
                Aired     = 24,
                Completed = 12,
                Episodes  = new List <ITraktEpisodeCollectionProgress>
                {
                    new TraktEpisodeCollectionProgress
                    {
                        Number      = 1,
                        Completed   = true,
                        CollectedAt = COLLECTED_AT
                    },
                    new TraktEpisodeCollectionProgress
                    {
                        Number      = 2,
                        Completed   = true,
                        CollectedAt = COLLECTED_AT
                    }
                }
            };

            var    traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktSeasonCollectionProgress);

            json.Should().Be(@"{""number"":1,""aired"":24,""completed"":12," +
                             @"""episodes"":[" +
                             $"{{\"number\":1,\"completed\":true,\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}," +
                             $"{{\"number\":2,\"completed\":true,\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}" +
                             "]}");
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_StringWriter_Only_Episodes_Property()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Episodes = new List <ITraktEpisodeCollectionProgress>
                {
                    new TraktEpisodeCollectionProgress
                    {
                        Number      = 1,
                        Completed   = true,
                        CollectedAt = COLLECTED_AT
                    },
                    new TraktEpisodeCollectionProgress
                    {
                        Number      = 2,
                        Completed   = true,
                        CollectedAt = COLLECTED_AT
                    }
                }
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktSeasonCollectionProgress);

                json.Should().Be(@"{""episodes"":[" +
                                 $"{{\"number\":1,\"completed\":true,\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}," +
                                 $"{{\"number\":2,\"completed\":true,\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"}}" +
                                 "]}");
            }
        }
 public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_StringWriter_Exceptions()
 {
     var traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
     ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress();
     Func <Task <string> >          action = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktSeasonCollectionProgress);
     await action.Should().ThrowAsync <ArgumentNullException>();
 }
        public void Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Exceptions()
        {
            var traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress();
            Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktSeasonCollectionProgress);

            action.Should().Throw <ArgumentNullException>();
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_Object_Only_Completed_Property()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Completed = 12
            };

            var    traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktSeasonCollectionProgress);

            json.Should().Be(@"{""completed"":12}");
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_Object_Only_Number_Property()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Number = 1
            };

            var    traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
            string json            = await traktJsonWriter.WriteObjectAsync(traktSeasonCollectionProgress);

            json.Should().Be(@"{""number"":1}");
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_StringWriter_Only_Aired_Property()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Aired = 24
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new SeasonCollectionProgressObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktSeasonCollectionProgress);

                json.Should().Be(@"{""aired"":24}");
            }
        }
        public async Task Test_SeasonCollectionProgressObjectJsonWriter_WriteObject_JsonWriter_Only_Completed_Property()
        {
            ITraktSeasonCollectionProgress traktSeasonCollectionProgress = new TraktSeasonCollectionProgress
            {
                Completed = 12
            };

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

                    stringWriter.ToString().Should().Be(@"{""completed"":12}");
                }
        }