* AsyncCalls.cs, BaseCalls.cs, DelegateCalls.cs, ReflectionCalls.cs,
[mono.git] / mcs / class / System.Runtime.Remoting / Test / DelegateCalls.cs
1 //
2 // MonoTests.Remoting.DelegateCalls.cs
3 //
4 // Author: Lluis Sanchez Gual (lluis@ximian.com)
5 //
6 // 2003 (C) Copyright, Ximian, Inc.
7 //
8
9 using System;
10 using System.Collections;
11 using NUnit.Framework;
12 using System.Text;
13 using System.Runtime.InteropServices;
14
15 namespace MonoTests.Remoting
16 {
17         public abstract class DelegateCallTest : BaseCallTest
18         {
19                 public override InstanceSurrogate GetInstanceSurrogate () { return new DelegateInstanceSurrogate (); }
20                 public override AbstractSurrogate GetAbstractSurrogate () { return new DelegateAbstractSurrogate (); }
21                 public override InterfaceSurrogate GetInterfaceSurrogate () { return new DelegateInterfaceSurrogate (); }
22         }
23
24         public class DelegateInstanceSurrogate : InstanceSurrogate
25         {
26                 public override int Simple ()
27                 {
28                         DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
29                         return de ();
30                 }
31
32                 public override string PrimitiveParams (int a, uint b, char c, string d)
33                 {
34                         DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
35                         return de (a,b,c,d);
36                 }
37
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)
39                 {
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);
42                 }
43
44                 public override Complex ComplexParams (ArrayList a, Complex b, string c)
45                 {
46                         DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
47                         return de (a,b,c);
48                 }
49
50                 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
51                 {
52                         DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
53                         return de (ref a, out b, bytes, sb, c);
54                 }
55
56                 public override void ProcessContextData ()
57                 {
58                         DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
59                         de ();
60                 }
61         }
62
63         public class DelegateAbstractSurrogate : AbstractSurrogate
64         {
65                 public override int Simple ()
66                 {
67                         DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
68                         return de ();
69                 }
70
71                 public override string PrimitiveParams (int a, uint b, char c, string d)
72                 {
73                         DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
74                         return de (a,b,c,d);
75                 }
76
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)
78                 {
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);
81                 }
82
83                 public override Complex ComplexParams (ArrayList a, Complex b, string c)
84                 {
85                         DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
86                         return de (a,b,c);
87                 }
88
89                 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
90                 {
91                         DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
92                         return de (ref a, out b, bytes, sb, c);
93                 }
94
95                 public override void ProcessContextData ()
96                 {
97                         DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
98                         de ();
99                 }
100         }
101
102         public class DelegateInterfaceSurrogate : InterfaceSurrogate
103         {
104                 public override int Simple ()
105                 {
106                         DelegateSimple de = new DelegateSimple (RemoteObject.Simple);
107                         return de ();
108                 }
109
110                 public override string PrimitiveParams (int a, uint b, char c, string d)
111                 {
112                         DelegatePrimitiveParams de = new DelegatePrimitiveParams (RemoteObject.PrimitiveParams);
113                         return de (a,b,c,d);
114                 }
115
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)
117                 {
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);
120                 }
121
122                 public override Complex ComplexParams (ArrayList a, Complex b, string c)
123                 {
124                         DelegateComplexParams de = new DelegateComplexParams (RemoteObject.ComplexParams);
125                         return de (a,b,c);
126                 }
127
128                 public override Complex ComplexParamsInOut (ref ArrayList a, out Complex b, [In,Out] byte[] bytes, [In,Out] StringBuilder sb, string c)
129                 {
130                         DelegateComplexParamsInOut de = new DelegateComplexParamsInOut (RemoteObject.ComplexParamsInOut);
131                         return de (ref a, out b, bytes, sb, c);
132                 }
133
134                 public override void ProcessContextData ()
135                 {
136                         DelegateProcessContextData de = new DelegateProcessContextData (RemoteObject.ProcessContextData);
137                         de ();
138                 }
139         }
140 }