WriteJson() публичный Метод

Writes the JSON representation of the object.
public WriteJson ( JsonWriter writer, object value, JsonSerializer serializer ) : void
writer Newtonsoft.Json.JsonWriter The Newtonsoft.Json.JsonWriter to write to.
value object The value.
serializer Newtonsoft.Json.JsonSerializer The calling serializer.
Результат void
        public void WriteJson(string expected, DateTimeOffset original)
        {
            var converter = new EpochTimeConverter();

            var sb = new StringBuilder();
            var stringWriter = new StringWriter(sb);
            var writer = new JsonTextWriter(stringWriter);
            var serializer = new JsonSerializer();

            converter.WriteJson(writer, original, serializer);

            var actual = sb.ToString();

            Assert.Equal(expected, actual);
        }
        public void WriteJson_ThrowsInvalidCastException(object data)
        {
            var converter = new EpochTimeConverter();

            var sb = new StringBuilder();
            var stringWriter = new StringWriter(sb);
            var writer = new JsonTextWriter(stringWriter);
            var serializer = new JsonSerializer();

            var exception = Record.Exception(() => converter.WriteJson(writer, data, serializer));
            Assert.NotNull(exception);
            Assert.IsType<InvalidCastException>(exception);
        }