public void TestProtoSerializesDataContractAsExpected() { WcfWithFields obj = new WcfWithFields { Foo = 123, Bar = "abc" }, clone = Serializer.DeepClone(obj); Assert.AreEqual(obj.Foo, clone.Foo, "Foo"); Assert.AreEqual(obj.Bar, clone.Bar, "Bar"); }
public void TestWcfSerializesDataContractAsExpected() { WcfWithFields obj = new WcfWithFields { Foo = 123, Bar = "abc" }, clone; DataContractSerializer dcs = new DataContractSerializer(typeof(WcfWithFields)); using (MemoryStream ms = new MemoryStream()) { dcs.WriteObject(ms, obj); ms.Position = 0; clone = (WcfWithFields)dcs.ReadObject(ms); } Assert.AreEqual(obj.Foo, clone.Foo, "Foo"); Assert.AreEqual(obj.Bar, clone.Bar, "Bar"); }