// // System.Runtime.Serialization.SerializationTest.cs // // Author: Lluis Sanchez Gual (lluis@ximian.com) // // (C) Ximian, Inc. // using System; using System.Diagnostics; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap; using System.Reflection; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Proxies; using System.Runtime.Remoting.Messaging; using System.Collections; using NUnit.Framework; namespace MonoTests.System.Runtime.Serialization.Formatters.Soap { [TestFixture] public class SerializationTest { MemoryStream ms; [Test] public void TestSerialization () { MethodTester mt = new MethodTester(); RemotingServices.Marshal (mt, "myuri"); WriteData(); ReadData(); RemotingServices.Disconnect (mt); } public static void Main() { SerializationTest test = new SerializationTest(); test.TestSerialization(); } void WriteData () { StreamingContext context = new StreamingContext (StreamingContextStates.Other); SurrogateSelector sel = new SurrogateSelector(); sel.AddSurrogate (typeof (Point), context, new PointSurrogate()); List list = CreateTestData(); BinderTester_A bta = CreateBinderTestData(); ms = new MemoryStream(); SoapFormatter f = new SoapFormatter (sel, new StreamingContext(StreamingContextStates.Other)); f.Serialize (ms, list); // ProcessMessages (ms, null); // f.Serialize (ms, bta); ms.Flush (); ms.Position = 0; StreamReader reader = new StreamReader(ms); Console.WriteLine(reader.ReadToEnd()); ms.Position = 0; } void ReadData() { StreamingContext context = new StreamingContext (StreamingContextStates.Other); SurrogateSelector sel = new SurrogateSelector(); sel.AddSurrogate (typeof (Point), context, new PointSurrogate()); SoapFormatter f = new SoapFormatter (sel, context); object list = f.Deserialize (ms); object[][] originalMsgData = null; IMessage[] calls = null; IMessage[] resps = null; // originalMsgData = ProcessMessages (null, null); // calls = new IMessage[originalMsgData.Length]; // resps = new IMessage[originalMsgData.Length]; // for (int n=0; n