public async Task Test_CommentLikeObjectJsonWriter_WriteObject_StringWriter_Complete() { ITraktCommentLike traktCommentLike = new TraktCommentLike { LikedAt = LIKED_AT, User = new TraktUser { Username = "******", IsPrivate = false, Name = "Sean Rudford", IsVIP = true, IsVIP_EP = true, Ids = new TraktUserIds { Slug = "sean" } } }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCommentLike); json.Should().Be($"{{\"liked_at\":\"{LIKED_AT.ToTraktLongDateTimeString()}\"," + @"""user"":{""username"":""sean"",""private"":false,""ids"":{""slug"":""sean""}," + @"""name"":""Sean Rudford"",""vip"":true,""vip_ep"":true}}"); } }
public async Task Test_CommentLikeArrayJsonWriter_WriteArray_StringWriter_SingleObject() { IEnumerable <ITraktCommentLike> traktCommentLikes = new List <ITraktCommentLike> { new TraktCommentLike { LikedAt = LIKED_AT, User = new TraktUser { Username = "******", IsPrivate = false, Name = "Sean Rudford", IsVIP = true, IsVIP_EP = true, Ids = new TraktUserIds { Slug = "sean" } } } }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ArrayJsonWriter <ITraktCommentLike>(); string json = await traktJsonWriter.WriteArrayAsync(stringWriter, traktCommentLikes); json.Should().Be($"[{{\"liked_at\":\"{LIKED_AT.ToTraktLongDateTimeString()}\"," + @"""user"":{""username"":""sean"",""private"":false,""ids"":{""slug"":""sean""}," + @"""name"":""Sean Rudford"",""vip"":true,""vip_ep"":true}}]"); } }
public async Task Test_CommentLikeObjectJsonWriter_WriteObject_StringWriter_Only_LikedAt_Property() { ITraktCommentLike traktCommentLike = new TraktCommentLike { LikedAt = LIKED_AT }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCommentLike); json.Should().Be($"{{\"liked_at\":\"{LIKED_AT.ToTraktLongDateTimeString()}\"}}"); } }