public void SerializeNullableEnum_WithNullValue()
        {
            JsonValueType?target = null;

            JsonValue expected = JsonValue.Null;

            var serializer = new JsonSerializer
            {
                Options =
                {
                    EnumSerializationFormat = EnumSerializationFormat.AsName
                }
            };
            var json = serializer.Serialize(target);

            Assert.AreEqual(expected, json);
        }
Beispiel #2
0
        public void DeserializeNullableEnum_WithNullValue()
        {
            JsonValueType?expected = null;

            JsonValue target = JsonValue.Null;

            var serializer = new JsonSerializer
            {
                Options =
                {
                    EnumSerializationFormat = EnumSerializationFormat.AsName
                }
            };
            var actual = serializer.Deserialize <JsonValueType?>(target);

            Assert.AreEqual(expected, actual);
        }