Ejemplo n.º 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>();
        }
Ejemplo n.º 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>();
 }
Ejemplo n.º 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()}\"}}");
        }
Ejemplo n.º 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}");
        }
Ejemplo n.º 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}");
        }
Ejemplo n.º 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()}\"}}");
        }
Ejemplo n.º 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()}\"}}");
                }
        }
Ejemplo n.º 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}");
                }
        }
Ejemplo n.º 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()}\"}}");
                }
        }