@@ -164,6 +164,97 @@ public void TestBytes()
164164 }
165165 }
166166
167+
168+ /// <summary>
169+ /// Some tests about the peculiarities of the handshake
170+ /// </summary>
171+ public class HandshakeTests
172+ {
173+ class MetadataProxy : PyroProxy
174+ {
175+ public MetadataProxy ( ) : base ( "test" , 999 , "object42" )
176+ {
177+ }
178+
179+ public void TestMetadataHashtable ( Hashtable table )
180+ {
181+ base . _processMetadata ( table ) ;
182+ }
183+
184+ public void TestMetadataDictionary ( IDictionary dict )
185+ {
186+ base . _processMetadata ( dict ) ;
187+ }
188+
189+ public void TestMetadataGenericDict ( IDictionary < object , object > dict )
190+ {
191+ base . _processMetadata ( dict ) ;
192+ }
193+ }
194+
195+
196+ [ Fact ]
197+ public void TestHandshakeDicts ( )
198+ {
199+ var proxy = new MetadataProxy ( ) ;
200+
201+ var hashtable = new Hashtable
202+ {
203+ { "methods" , new object [ ] { "method1" } } ,
204+ { "attrs" , new List < object > ( ) { "attr1" } } ,
205+ { "oneway" , new HashSet < object > ( ) { "oneway1" } }
206+ } ;
207+ var dict = new SortedList
208+ {
209+ { "methods" , new object [ ] { "method1" } } ,
210+ { "attrs" , new List < object > ( ) { "attr1" } } ,
211+ { "oneway" , new HashSet < object > ( ) { "oneway1" } }
212+ } ;
213+ var gdict = new Dictionary < object , object >
214+ {
215+ { "methods" , new object [ ] { "method1" } } ,
216+ { "attrs" , new List < object > ( ) { "attr1" } } ,
217+ { "oneway" , new HashSet < object > ( ) { "oneway1" } }
218+ } ;
219+
220+ var expectedMethods = new HashSet < string > { "method1" } ;
221+ var expectedAttrs = new HashSet < string > { "attr1" } ;
222+ var expectedOneway = new HashSet < string > { "oneway1" } ;
223+
224+ proxy . pyroMethods . Clear ( ) ;
225+ proxy . pyroAttrs . Clear ( ) ;
226+ proxy . pyroOneway . Clear ( ) ;
227+ proxy . TestMetadataHashtable ( hashtable ) ;
228+ Assert . Equal ( expectedMethods , proxy . pyroMethods ) ;
229+ Assert . Equal ( expectedAttrs , proxy . pyroAttrs ) ;
230+ Assert . Equal ( expectedOneway , proxy . pyroOneway ) ;
231+
232+ proxy . pyroMethods . Clear ( ) ;
233+ proxy . pyroAttrs . Clear ( ) ;
234+ proxy . pyroOneway . Clear ( ) ;
235+ proxy . TestMetadataDictionary ( dict ) ;
236+ Assert . Equal ( expectedMethods , proxy . pyroMethods ) ;
237+ Assert . Equal ( expectedAttrs , proxy . pyroAttrs ) ;
238+ Assert . Equal ( expectedOneway , proxy . pyroOneway ) ;
239+
240+ proxy . pyroMethods . Clear ( ) ;
241+ proxy . pyroAttrs . Clear ( ) ;
242+ proxy . pyroOneway . Clear ( ) ;
243+ proxy . TestMetadataDictionary ( gdict ) ;
244+ Assert . Equal ( expectedMethods , proxy . pyroMethods ) ;
245+ Assert . Equal ( expectedAttrs , proxy . pyroAttrs ) ;
246+ Assert . Equal ( expectedOneway , proxy . pyroOneway ) ;
247+
248+ proxy . pyroMethods . Clear ( ) ;
249+ proxy . pyroAttrs . Clear ( ) ;
250+ proxy . pyroOneway . Clear ( ) ;
251+ proxy . TestMetadataGenericDict ( gdict ) ;
252+ Assert . Equal ( expectedMethods , proxy . pyroMethods ) ;
253+ Assert . Equal ( expectedAttrs , proxy . pyroAttrs ) ;
254+ Assert . Equal ( expectedOneway , proxy . pyroOneway ) ;
255+ }
256+ }
257+
167258 /// <summary>
168259 /// Miscellaneous tests.
169260 /// </summary>
0 commit comments