public void Deserialize_SerializationRepresentation_DeserializedObject()
        {
            var subject = new DataContractJsonDeserializer();
            var deserialized = subject.Deserialize<Serializable>(Serializable.DataContractJsonString("s", 3m));

                Assert.That(deserialized.D, Is.EqualTo(3m));
                Assert.That(deserialized.S, Is.EqualTo("s"));
        }
Example #2
0
        public void DefaultDeserialiation_NotLikeCanonicalJsonSerialization()
        {
            string customValue = "{\"amount\":14.3,\"currency\":963}";
            var    serializer  = new DataContractJsonDeserializer();

            Assert.That(() => JsonConvert.DeserializeObject <Money>(customValue), Throws.Nothing);
            Assert.That(() => serializer.Deserialize <Money>(customValue), Throws.InstanceOf <SerializationException>());
        }
Example #3
0
        public void Deserialize_SerializationRepresentation_DeserializedObject()
        {
            var subject      = new DataContractJsonDeserializer();
            var deserialized = subject.Deserialize <Serializable>(Serializable.DataContractJsonString("s", 3m));

            Assert.That(deserialized.D, Is.EqualTo(3m));
            Assert.That(deserialized.S, Is.EqualTo("s"));
        }
        public void Deserialize_InvalidSerializationRepresentation_Extepcion()
        {
            var subject = new DataContractJsonDeserializer();

            Assert.That(() => subject.Deserialize<Serializable>("invalid"), Throws.InstanceOf<SerializationException>());
        }
Example #5
0
        public void Deserialize_InvalidSerializationRepresentation_Extepcion()
        {
            var subject = new DataContractJsonDeserializer();

            Assert.That(() => subject.Deserialize <Serializable>("invalid"), Throws.InstanceOf <SerializationException>());
        }