**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Runtime.Remoting / Test / DelegateCalls.cs
blobf21da9788f3161f15f448f1b6bc2e2097a31012a
1 //
2 // MonoTests.Remoting.DelegateCalls.cs
3 //
4 // Author: Lluis Sanchez Gual (lluis@ximian.com)
5 //
6 // 2003 (C) Copyright, Ximian, Inc.
7 //
9 using System;
10 using System.Collections;
11 using NUnit.Framework;
12 using System.Text;
13 using System.Runtime.InteropServices;
15 namespace MonoTests.Remoting
17 public abstract class DelegateCallTest : BaseCallTest
19 public override InstanceSurrogate GetInstanceSurrogate () { return new DelegateInstanceSurrogate (); }
20 public override AbstractSurrogate GetAbstractSurrogate () { return new DelegateAbstractSurrogate (); }
21 public override InterfaceSurrogate GetInterfaceSurrogate () { return new DelegateInterfaceSurrogate (); }
24 public class DelegateInstanceSurrogate : InstanceSurrogate
26 public override int Simple ()
28 DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
29 return de ();
32 public override string PrimitiveParams (int a, uint b, char c, string d)
34 DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
35 return de (a,b,c,d);
38 public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, int filler, ref char c1, out char c2, ref string d1, out string d2)
40 DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut);
41 return de (ref a1, out a2, ref b1, out b2, filler, ref c1, out c2, ref d1, out d2);
44 public override Complex ComplexParams (ArrayList a, Complex b, string c)
46 DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
47 return de (a,b,c);
50 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
52 DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
53 return de (ref a, out b, bytes, sb, c);
56 public override void ProcessContextData ()
58 DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
59 de ();
63 public class DelegateAbstractSurrogate : AbstractSurrogate
65 public override int Simple ()
67 DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
68 return de ();
71 public override string PrimitiveParams (int a, uint b, char c, string d)
73 DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
74 return de (a,b,c,d);
77 public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, int filler, ref char c1, out char c2, ref string d1, out string d2)
79 DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut);
80 return de (ref a1, out a2, ref b1, out b2, filler, ref c1, out c2, ref d1, out d2);
83 public override Complex ComplexParams (ArrayList a, Complex b, string c)
85 DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
86 return de (a,b,c);
89 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
91 DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
92 return de (ref a, out b, bytes, sb, c);
95 public override void ProcessContextData ()
97 DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
98 de ();
102 public class DelegateInterfaceSurrogate : InterfaceSurrogate
104 public override int Simple ()
106 DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
107 return de ();
110 public override string PrimitiveParams (int a, uint b, char c, string d)
112 DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
113 return de (a,b,c,d);
116 public override string PrimitiveParamsInOut (ref int a1, out int a2, ref float b1, out float b2, int filler, ref char c1, out char c2, ref string d1, out string d2)
118 DelegatePrimitiveParamsInOut de = new DelegatePrimitiveParamsInOut (RemoteObject.PrimitiveParamsInOut);
119 return de (ref a1, out a2, ref b1, out b2, filler, ref c1, out c2, ref d1, out d2);
122 public override Complex ComplexParams (ArrayList a, Complex b, string c)
124 DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
125 return de (a,b,c);
128 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
130 DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
131 return de (ref a, out b, bytes, sb, c);
134 public override void ProcessContextData ()
136 DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
137 de ();