Exemplo n.º 1
0
		public void GetItems2 ()
		{
			// GetItems() returns IEnumerable<KeyValuePair<,>>
			var i = new XamlType (typeof (Dictionary<int,string>), sctx).Invoker;
			var dic = new Dictionary<int,string> ();
			dic [5] = "foo";
			dic [-3] = "bar";
			dic [0] = "baz";
			var items = i.GetItems (dic);
			var arr = new List<object> ();
			while (items.MoveNext ())
				arr.Add (items.Current);
			Assert.AreEqual (new KeyValuePair<int,string> (5, "foo"), arr [0], "#1");
			Assert.AreEqual (new KeyValuePair<int,string> (0, "baz"), arr [2], "#1");
		}
Exemplo n.º 2
0
		public void GetItems ()
		{
			var i = new XamlType (typeof (List<int>), sctx).Invoker;
			var list = new int [] {5, -3, 0}.ToList ();
			var items = i.GetItems (list);
			var arr = new List<object> ();
			while (items.MoveNext ())
				arr.Add (items.Current);
			Assert.AreEqual (5, arr [0], "#1");
			Assert.AreEqual (0, arr [2], "#2");
		}