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 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>()); }
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>()); }
public void Deserialize_InvalidSerializationRepresentation_Extepcion() { var subject = new DataContractJsonDeserializer(); Assert.That(() => subject.Deserialize <Serializable>("invalid"), Throws.InstanceOf <SerializationException>()); }