示例#1
0
        public void CanDeserialiseNullableTimespan()
        {
            var itm          = new TimeSpan(1500);
            var testObj      = new NullableTestType <TimeSpan>(itm);
            var serialised   = NetJSON.Serialize(testObj);
            var deserialised = NetJSON.Deserialize <NullableTestType <TimeSpan> >(serialised);

            Assert.IsNotNull(deserialised);
            Assert.IsNotNull(deserialised.TestItem);
            Assert.AreEqual(testObj.TestItem.Value, itm);
        }
示例#2
0
        public void CanDeserialiseNullableGuid()
        {
            var itm          = new Guid("10b5a72b-815f-4e64-90bf-cb250840e989");
            var testObj      = new NullableTestType <Guid>(itm);
            var serialised   = NetJSON.Serialize(testObj);
            var deserialised = NetJSON.Deserialize <NullableTestType <Guid> >(serialised);

            Assert.IsNotNull(deserialised);
            Assert.IsNotNull(deserialised.TestItem);
            Assert.AreEqual(testObj.TestItem.Value, itm);
        }
示例#3
0
        public void CanDeserialiseNullableDateTime()
        {
            var itm          = new DateTime(2015, 12, 15);
            var testObj      = new NullableTestType <DateTime>(itm);
            var serialised   = NetJSON.Serialize(testObj);
            var deserialised = NetJSON.Deserialize <NullableTestType <DateTime> >(serialised);

            Assert.IsNotNull(deserialised);
            Assert.IsNotNull(deserialised.TestItem);
            Assert.AreEqual(testObj.TestItem.Value, itm);
        }