Пример #1
0
        public void CanSerializeToLong_WithNewtonsoftJsonProvider()
        {
            var foo = new NewtonsoftJsonLongId(123);

            var serializedFoo  = NewtonsoftJsonSerializer.SerializeObject(foo);
            var serializedLong = NewtonsoftJsonSerializer.SerializeObject(foo.Value);

            Assert.Equal(serializedFoo, serializedLong);
        }
Пример #2
0
        public void CanDeserializeFromLong_WithNewtonsoftJsonProvider()
        {
            var value          = 123L;
            var foo            = new NewtonsoftJsonLongId(value);
            var serializedLong = NewtonsoftJsonSerializer.SerializeObject(value);

            var deserializedFoo = NewtonsoftJsonSerializer.DeserializeObject <NewtonsoftJsonLongId>(serializedLong);

            Assert.Equal(foo, deserializedFoo);
        }