public async Task Test_CommentLikeObjectJsonWriter_WriteObject_JsonWriter_Only_User_Property() { ITraktCommentLike traktCommentLike = new TraktCommentLike { User = new TraktUser { Username = "******", IsPrivate = false, Name = "Sean Rudford", IsVIP = true, IsVIP_EP = true, Ids = new TraktUserIds { Slug = "sean" } } }; using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentLike); stringWriter.ToString().Should().Be(@"{""user"":{""username"":""sean"",""private"":false,""ids"":{""slug"":""sean""}," + @"""name"":""Sean Rudford"",""vip"":true,""vip_ep"":true}}"); } }
public async Task Test_CommentLikeObjectJsonWriter_WriteObject_JsonWriter_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()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentLike); stringWriter.ToString().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_Exceptions() { var traktJsonWriter = new CommentLikeObjectJsonWriter(); ITraktCommentLike traktCommentLike = new TraktCommentLike(); Func <Task <string> > action = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktCommentLike); await action.Should().ThrowAsync <ArgumentNullException>(); }
public void Test_CommentLikeObjectJsonWriter_WriteObject_JsonWriter_Exceptions() { var traktJsonWriter = new CommentLikeObjectJsonWriter(); ITraktCommentLike traktCommentLike = new TraktCommentLike(); Func <Task> action = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktCommentLike); action.Should().Throw <ArgumentNullException>(); }
public async Task Test_CommentLikeObjectJsonWriter_WriteObject_StringWriter_Empty() { ITraktCommentLike traktCommentLike = new TraktCommentLike(); using (var stringWriter = new StringWriter()) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); string json = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCommentLike); json.Should().Be(@"{}"); } }
public async Task Test_CommentLikeObjectJsonWriter_WriteObject_JsonWriter_Empty() { ITraktCommentLike traktCommentLike = new TraktCommentLike(); using (var stringWriter = new StringWriter()) using (var jsonWriter = new JsonTextWriter(stringWriter)) { var traktJsonWriter = new CommentLikeObjectJsonWriter(); await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentLike); stringWriter.ToString().Should().Be(@"{}"); } }
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()}\"}}"); } }