public void DeserializeIntoValueTypeFails()
        {
            Serializer    s    = new Serializer();
            string        json = "{X:5,Y:10}";
            MockValueType mv   = new MockValueType();

            s.Deserialize(json, mv);
        }
        public void StructTypeTest()
        {
            Serializer    s      = new Serializer();
            MockValueType value  = new MockValueType(5, 10);
            string        result = s.Serialize(value);

            MockValueType actual = s.Deserialize <MockValueType>(result);

            Assert.AreEqual(value, actual, "Structs not equal");
        }
예제 #3
0
        public void AssemblyAliasTest()
        {
            Serializer    s      = GetSerializer();
            MockValueType source = new MockValueType(9, 6);

            s.Settings.TypeAliases.Assemblies.Add(typeof(MockValueType).Assembly);
            string result = s.Serialize <object>(source);

            StringAssert.FullMatch(result, @"\s*\(JsonExSerializerTests\.Mocks\.MockValueType\)\s*{""X"":9, ""Y"":6}");
            MockValueType target = s.Deserialize <MockValueType>(result);

            Assert.AreEqual(source, target, "Deserialize");
        }