public void Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_Object_Exceptions() { var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(ITraktEpisodeWatchedProgress)); action.Should().Throw <ArgumentNullException>(); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_StringWriter_Exceptions() { var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktEpisodeWatchedProgress); await action.Should().ThrowAsync <ArgumentNullException>(); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_Object_Only_LastWatchedAt_Property() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { LastWatchedAt = LAST_WATCHED_AT }; var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktEpisodeWatchedProgress); json.Should().Be($"{{\"last_watched_at\":\"{LAST_WATCHED_AT.ToTraktLongDateTimeString()}\"}}"); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_Object_Only_Completed_Property() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { Completed = true }; var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktEpisodeWatchedProgress); json.Should().Be(@"{""completed"":true}"); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_Object_Only_Number_Property() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { Number = 1 }; var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktEpisodeWatchedProgress); json.Should().Be(@"{""number"":1}"); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_Object_Complete() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { Number = 1, Completed = true, LastWatchedAt = LAST_WATCHED_AT }; var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktEpisodeWatchedProgress); json.Should().Be(@"{""number"":1,""completed"":true," + $"\"last_watched_at\":\"{LAST_WATCHED_AT.ToTraktLongDateTimeString()}\"}}"); }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_JsonWriter_Only_LastWatchedAt_Property() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { LastWatchedAt = LAST_WATCHED_AT }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeWatchedProgress); stringWriter.ToString().Should().Be($"{{\"last_watched_at\":\"{LAST_WATCHED_AT.ToTraktLongDateTimeString()}\"}}"); } }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_JsonWriter_Only_Completed_Property() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { Completed = true }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeWatchedProgress); stringWriter.ToString().Should().Be(@"{""completed"":true}"); } }
public async Task Test_EpisodeWatchedProgressObjectJsonWriter_WriteObject_JsonWriter_Complete() { ITraktEpisodeWatchedProgress traktEpisodeWatchedProgress = new TraktEpisodeWatchedProgress { Number = 1, Completed = true, LastWatchedAt = LAST_WATCHED_AT }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new EpisodeWatchedProgressObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktEpisodeWatchedProgress); stringWriter.ToString().Should().Be(@"{""number"":1,""completed"":true," + $"\"last_watched_at\":\"{LAST_WATCHED_AT.ToTraktLongDateTimeString()}\"}}"); } }