public void TestDataContractWithPrimitiveHavingSameQName() { // This test verifies that a primitive with the same qname as the // DataContract succeeds in serializing and deserializing var serializer4 = new DataContractSerializer(typeof(DataContract4)); var d = new DataContract4(); var ms = new MemoryStream(2048); Assert.IsNotNull(serializer4, "Failed to create the serializer for DataContract4"); d.Test1 = 3.1416; serializer4.WriteObject(ms, d); ms.Position = 0; var d2 = serializer4.ReadObject(ms) as DataContract4; Assert.IsNotNull(d2, "Failed to deserialize the data buffer into a DataContract4"); Assert.AreEqual(d2.Test1, 3.1416, "Rehydrated Test1 property did not match original"); Assert.AreNotSame(d2, d, "The instances are the same and should not be"); }
public void TestDataContractWithPrimitiveHavingSameQName () { // This test verifies that a primitive with the same qname as the // DataContract succeeds in serializing and deserializing var serializer4 = new DataContractSerializer (typeof(DataContract4)); var d = new DataContract4 (); var ms = new MemoryStream (2048); Assert.IsNotNull (serializer4, "Failed to create the serializer for DataContract4"); d.Test1 = 3.1416; serializer4.WriteObject (ms, d); ms.Position = 0; var d2 = serializer4.ReadObject (ms) as DataContract4; Assert.IsNotNull (d2, "Failed to deserialize the data buffer into a DataContract4"); Assert.AreEqual (d2.Test1, 3.1416, "Rehydrated Test1 property did not match original"); Assert.AreNotSame (d2, d, "The instances are the same and should not be"); }