示例#1
0
 def test_ArrayList(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections', 'ArrayList')
     obj = ArrayList()
     obj.Add(42)
     obj.Add(43)
     total = obj.get_Item(0) + obj.get_Item(1)
     assert total == 42+43
示例#2
0
 def test_ArrayList(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections',
                                    'ArrayList')
     obj = ArrayList()
     obj.Add(42)
     obj.Add(43)
     total = obj.get_Item(0) + obj.get_Item(1)
     assert total == 42 + 43
示例#3
0
 def test_float_conversion(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections', 'ArrayList')
     obj = ArrayList()
     obj.Add(42.0)
     item = obj.get_Item(0)
     assert isinstance(item, float)
示例#4
0
 def test_unboundmethod(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections',
                                    'ArrayList')
     obj = ArrayList()
     ArrayList.Add(obj, 42)
     assert obj.get_Item(0) == 42
示例#5
0
 def test_float_conversion(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections',
                                    'ArrayList')
     obj = ArrayList()
     obj.Add(42.0)
     item = obj.get_Item(0)
     assert isinstance(item, float)
示例#6
0
 def test_bool_conversion(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections', 'ArrayList')
     obj = ArrayList()
     obj.Add(True)
     obj.Add(False)
     t = obj.get_Item(0)
     f = obj.get_Item(1)
     assert t and isinstance(t, bool)
     assert not f and isinstance(f, bool)
     obj.Add(42)
     assert obj.Contains(42)
示例#7
0
 def test_bool_conversion(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections',
                                    'ArrayList')
     obj = ArrayList()
     obj.Add(True)
     obj.Add(False)
     t = obj.get_Item(0)
     f = obj.get_Item(1)
     assert t and isinstance(t, bool)
     assert not f and isinstance(f, bool)
     obj.Add(42)
     assert obj.Contains(42)
示例#8
0
 def test_unboundmethod(self):
     import clr
     ArrayList = clr.load_cli_class(self.mscorlib, 'System.Collections', 'ArrayList')
     obj = ArrayList()
     ArrayList.Add(obj, 42)
     assert obj.get_Item(0) == 42