2 // MonoTests.Remoting.DelegateCalls.cs
4 // Author: Lluis Sanchez Gual (lluis@ximian.com)
6 // 2003 (C) Copyright, Ximian, Inc.
10 using System
.Collections
;
11 using NUnit
.Framework
;
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
);
32 public override string PrimitiveParams (int a
, uint b
, char c
, string d
)
34 DelegatePrimitiveParams de
= new DelegatePrimitiveParams (RemoteObject
.PrimitiveParams
);
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
);
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
);
63 public class DelegateAbstractSurrogate
: AbstractSurrogate
65 public override int Simple ()
67 DelegateSimple de
= new DelegateSimple (RemoteObject
.Simple
);
71 public override string PrimitiveParams (int a
, uint b
, char c
, string d
)
73 DelegatePrimitiveParams de
= new DelegatePrimitiveParams (RemoteObject
.PrimitiveParams
);
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
);
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
);
102 public class DelegateInterfaceSurrogate
: InterfaceSurrogate
104 public override int Simple ()
106 DelegateSimple de
= new DelegateSimple (RemoteObject
.Simple
);
110 public override string PrimitiveParams (int a
, uint b
, char c
, string d
)
112 DelegatePrimitiveParams de
= new DelegatePrimitiveParams (RemoteObject
.PrimitiveParams
);
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
);
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
);