public void Test_EpisodeCollectionProgressObjectJsonWriter_WriteObject_Object_Exceptions() { var traktJsonWriter = new EpisodeCollectionProgressObjectJsonWriter(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(ITraktEpisodeCollectionProgress)); action.Should().Throw <ArgumentNullException>(); }
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>(); }
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()}\"}}"); }
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}"); }
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}"); }
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()}\"}}"); }
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()}\"}}"); } }
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}"); } }
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()}\"}}"); } }