public void Test_StatisticsObjectJsonWriter_WriteObject_Object_Exceptions() { var traktJsonWriter = new StatisticsObjectJsonWriter(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(ITraktStatistics)); action.Should().Throw <ArgumentNullException>(); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_JsonWriter_Exceptions() { var traktJsonWriter = new StatisticsObjectJsonWriter(); ITraktStatistics traktStatistics = new TraktStatistics(); Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktStatistics); await action.Should().ThrowAsync <ArgumentNullException>(); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_Object_Only_Lists_Property() { ITraktStatistics traktStatistics = new TraktStatistics { Lists = 6 }; var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktStatistics); json.Should().Be(@"{""lists"":6}"); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_Object_Only_CollectedEpisodes_Property() { ITraktStatistics traktStatistics = new TraktStatistics { CollectedEpisodes = 4 }; var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktStatistics); json.Should().Be(@"{""collected_episodes"":4}"); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_Object_Only_Watchers_Property() { ITraktStatistics traktStatistics = new TraktStatistics { Watchers = 1 }; var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktStatistics); json.Should().Be(@"{""watchers"":1}"); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_StringWriter_Only_Comments_Property() { ITraktStatistics traktStatistics = new TraktStatistics { Comments = 5 }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktStatistics); json.Should().Be(@"{""comments"":5}"); } }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_StringWriter_Only_Recommended_Property() { ITraktStatistics traktStatistics = new TraktStatistics { Recommended = 8 }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktStatistics); json.Should().Be(@"{""recommended"":8}"); } }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_JsonWriter_Only_CollectedEpisodes_Property() { ITraktStatistics traktStatistics = new TraktStatistics { CollectedEpisodes = 4 }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new StatisticsObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktStatistics); stringWriter.ToString().Should().Be(@"{""collected_episodes"":4}"); } }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_JsonWriter_Only_Plays_Property() { ITraktStatistics traktStatistics = new TraktStatistics { Plays = 2 }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new StatisticsObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktStatistics); stringWriter.ToString().Should().Be(@"{""plays"":2}"); } }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_Object_Complete() { ITraktStatistics traktStatistics = new TraktStatistics { Watchers = 1, Plays = 2, Collectors = 3, CollectedEpisodes = 4, Comments = 5, Lists = 6, Votes = 7 }; var traktJsonWriter = new StatisticsObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(traktStatistics); json.Should().Be(@"{""watchers"":1,""plays"":2,""collectors"":3," + @"""collected_episodes"":4,""comments"":5,""lists"":6,""votes"":7}"); }
public async Task Test_StatisticsObjectJsonWriter_WriteObject_JsonWriter_Complete() { ITraktStatistics traktStatistics = new TraktStatistics { Watchers = 1, Plays = 2, Collectors = 3, CollectedEpisodes = 4, Comments = 5, Lists = 6, Votes = 7 }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new StatisticsObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktStatistics); stringWriter.ToString().Should().Be(@"{""watchers"":1,""plays"":2,""collectors"":3," + @"""collected_episodes"":4,""comments"":5,""lists"":6,""votes"":7}"); } }
public void Test_StatisticsObjectJsonWriter_WriteObject_Object_Exceptions() { var traktJsonWriter = new StatisticsObjectJsonWriter(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default);