ReadJson() 공개 메소드

Reads the JSON representation of the object.
public ReadJson ( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) : object
reader Newtonsoft.Json.JsonReader The Newtonsoft.Json.JsonReader to read from.
objectType System.Type Type of the object.
existingValue object The existing value of object being read.
serializer Newtonsoft.Json.JsonSerializer The calling serializer.
리턴 object
        public void NotificationConverter_ReadJsonCommentNotification_Equal()
        {
            var converter = new NotificationConverter();
            var reader =
                new JsonTextReader(new StringReader(MockAccountEndpointResponses.GetCommentNotification));
            reader.Read();
            var serializer = new JsonSerializer();

            var actual =
                (CommentNotification) converter.ReadJson(reader, typeof(CommentNotification), null, serializer);
            Assert.NotNull(actual);

            Assert.Equal(null, actual.AlbumCover);
            Assert.Equal("jasdev", actual.Author);
            Assert.Equal(3698510, actual.AuthorId);
            Assert.Equal(0, actual.Children.Count());
            Assert.Equal("Reply test", actual.CommentText);
            Assert.Equal(new DateTimeOffset(new DateTime(2014, 07, 22, 23, 12, 54, DateTimeKind.Utc)),
                actual.DateTime);
            Assert.Equal(false, actual.Deleted);
            Assert.Equal(0, actual.Downs);
            Assert.Equal("VK9VqcM", actual.ImageId);
            Assert.Equal(false, actual.OnAlbum);
            Assert.Equal(3615, actual.ParentId);
            Assert.Equal(1, actual.Points);
            Assert.Equal(1, actual.Ups);
            Assert.Equal(3616, actual.Id);
        }
        public void NotificationConverter_ReadJsonMessageNotification_AreEqual()
        {
            var converter = new NotificationConverter();
            var reader =
                new JsonTextReader(new StringReader(AccountEndpointResponses.GetMessageNotification));
            reader.Read();
            var serializer = new JsonSerializer();

            var actual = (Message) converter.ReadJson(reader, typeof (Message), null, serializer);
            Assert.IsNotNull(actual);

            Assert.AreEqual(76767, actual.Id);
            Assert.AreEqual("Bob", actual.From);
            Assert.AreEqual(89898, actual.AccountId);
            Assert.AreEqual(3434, actual.WithAccountId);
            Assert.AreEqual("Test33", actual.LastMessage);
            Assert.AreEqual(2, actual.MessageNum);
            Assert.AreEqual(new DateTimeOffset(new DateTime(2015, 10, 12, 02, 31, 43, DateTimeKind.Utc)),
                actual.DateTime);
        }