public async Task Test_CollectionShowSeasonObjectJsonWriter_WriteObject_StringWriter_Exceptions() { var traktJsonWriter = new CollectionShowSeasonObjectJsonWriter(); ITraktCollectionShowSeason traktCollectionShowSeason = new TraktCollectionShowSeason(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktCollectionShowSeason); await action.Should().ThrowAsync <ArgumentNullException>(); }
public void Test_CollectionShowSeasonObjectJsonWriter_WriteObject_JsonWriter_Exceptions() { var traktJsonWriter = new CollectionShowSeasonObjectJsonWriter(); ITraktCollectionShowSeason traktCollectionShowSeason = new TraktCollectionShowSeason(); Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktCollectionShowSeason); action.Should().Throw <ArgumentNullException>(); }
public async Task Test_CollectionShowSeasonObjectJsonWriter_WriteObject_JsonWriter_Complete() { ITraktCollectionShowSeason traktCollectionShowSeason = new TraktCollectionShowSeason { Number = 1, Episodes = new List <ITraktCollectionShowEpisode> { new TraktCollectionShowEpisode { Number = 1, CollectedAt = COLLECTED_AT, Metadata = new TraktMetadata { MediaType = TraktMediaType.Digital, MediaResolution = TraktMediaResolution.HD_720p, Audio = TraktMediaAudio.AAC, AudioChannels = TraktMediaAudioChannel.Channels_5_1, ThreeDimensional = true } }, new TraktCollectionShowEpisode { Number = 1, CollectedAt = COLLECTED_AT, Metadata = new TraktMetadata { MediaType = TraktMediaType.Digital, MediaResolution = TraktMediaResolution.HD_720p, Audio = TraktMediaAudio.AAC, AudioChannels = TraktMediaAudioChannel.Channels_5_1, ThreeDimensional = true } } } }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new CollectionShowSeasonObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCollectionShowSeason); stringWriter.ToString().Should().Be(@"{""number"":1,""episodes"":[{""number"":1," + $"\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"," + @"""metadata"":{""media_type"":""digital""," + @"""resolution"":""hd_720p"",""audio"":""aac""," + @"""audio_channels"":""5.1"",""3d"":true}}," + @"{""number"":1," + $"\"collected_at\":\"{COLLECTED_AT.ToTraktLongDateTimeString()}\"," + @"""metadata"":{""media_type"":""digital""," + @"""resolution"":""hd_720p"",""audio"":""aac""," + @"""audio_channels"":""5.1"",""3d"":true}}]}"); } }
public async Task Test_CollectionShowSeasonObjectJsonWriter_WriteObject_StringWriter_Only_Number_Property() { ITraktCollectionShowSeason traktCollectionShowSeason = new TraktCollectionShowSeason { Number = 1 }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new CollectionShowSeasonObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCollectionShowSeason); json.Should().Be(@"{""number"":1}"); } }
public async Task Test_CollectionShowSeasonObjectJsonWriter_WriteObject_Object_Exceptions() { var traktJsonWriter = new CollectionShowSeasonObjectJsonWriter(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default);