コード例 #1
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"));
        }
コード例 #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>());
        }
コード例 #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"));
        }
コード例 #4
0
        public void Deserialize_InvalidSerializationRepresentation_Extepcion()
        {
            var subject = new DataContractJsonDeserializer();

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

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