コード例 #1
0
ファイル: Fields.cs プロジェクト: XewTurquish/vsminecraft
 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");
 }
コード例 #2
0
ファイル: Fields.cs プロジェクト: cash2one/HBNews
        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");
        }
コード例 #3
0
ファイル: Fields.cs プロジェクト: XewTurquish/vsminecraft
 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");
 }
コード例 #4
0
ファイル: Fields.cs プロジェクト: cash2one/HBNews
        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");
        }