Beispiel #1
0
        public void AddToCollectionTypeMismatch()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));
            var l = new List <int> ();

            i.AddToCollection(l, "5");
        }
Beispiel #2
0
        public void AddToCollectionArrayInstance()
        {
            var i  = new XamlTypeInvoker(new XamlType(typeof(int []), sctx));
            var ax = new ArrayExtension();

            Assert.Throws <NotSupportedException> (() => i.AddToCollection(ax, 5));
        }
Beispiel #3
0
        public void AddToCollectionArrayInstance()
        {
            var i  = new XamlTypeInvoker(new XamlType(typeof(int []), sctx));
            var ax = new ArrayExtension();

            i.AddToCollection(ax, 5);
        }
Beispiel #4
0
        public void AddToCollectionList_NonCollectionType()
        {
            // so, the source collection type is not checked at all.
            var i = new XamlTypeInvoker(new XamlType(typeof(Uri), sctx));

            i.AddToCollection(new List <TimeSpan> (), TimeSpan.Zero);             // it is allowed too.
        }
Beispiel #5
0
        public void AddToCollectionTypeMismatch()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));
            var l = new List <int> ();

            Assert.Throws <ArgumentException> (() => i.AddToCollection(l, "5"));
        }
        public void AddToCollectionList_ObjectTypeMismatch()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));

            try {
                i.AddToCollection(new ArrayExtension(), 5);
                Assert.Fail("not supported operation.");
            } catch (NotSupportedException) {
            } catch (TargetException) {
                // .NET throws this, but the difference should not really matter.
            }
        }
        public void AddToCollectionNoUnderlyingType()
        {
            var i = new XamlTypeInvoker(new XamlType("urn:foo", "FooType", null, sctx));

            i.AddToCollection(new List <int> (), 5);             // ... passes.
        }
		public void AddToCollectionTypeMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			var l = new List<int> ();
			i.AddToCollection (l, "5");
		}
        public void AddToCollectionList_ObjectTypeMismatch4()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <Uri>), sctx));

            i.AddToCollection(new List <TimeSpan> (), TimeSpan.Zero);             // it is allowed too.
        }
		public void AddToCollectionList_NonCollectionType ()
		{
			// so, the source collection type is not checked at all.
			var i = new XamlTypeInvoker (new XamlType (typeof (Uri), sctx));
			i.AddToCollection (new List<TimeSpan> (), TimeSpan.Zero); // it is allowed too.
		}
		public void AddToCollectionList_ObjectTypeMismatch4 ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<Uri>), sctx));
			i.AddToCollection (new List<TimeSpan> (), TimeSpan.Zero); // it is allowed too.
		}
		public void AddToCollectionList_ObjectTypeMismatch3 ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<object>), sctx));
			i.AddToCollection (new List<int> (), 5); // it is allowed too.
		}
		public void AddToCollectionList_ObjectTypeMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			try {
				i.AddToCollection (new ArrayExtension (), 5);
				Assert.Fail ("not supported operation.");
			} catch (NotSupportedException) {
			} catch (TargetException) {
				// .NET throws this, but the difference should not really matter.
			}
		}
		public void AddToCollectionArrayInstance ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			var ax = new ArrayExtension ();
			Assert.Throws<NotSupportedException> (() => i.AddToCollection (ax, 5));
		}
		public void AddToCollectionNoUnderlyingType ()
		{
			var i = new XamlTypeInvoker (new XamlType ("urn:foo", "FooType", null, sctx));
			i.AddToCollection (new List<int> (), 5); // ... passes.
		}
		public void AddToCollectionList ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			var l = new List<int> ();
			i.AddToCollection (l, 5);
			i.AddToCollection (l, 3);
			i.AddToCollection (l, -12);
			Assert.AreEqual (3, l.Count, "#1");
			Assert.AreEqual (-12, l [2], "#2");
		}
        public void AddToCollectionList_ObjectTypeMismatch3()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <object>), sctx));

            i.AddToCollection(new List <int> (), 5);             // it is allowed too.
        }
		public void AddToCollectionTypeMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			var l = new List<int> ();
			Assert.Throws<ArgumentException> (() => i.AddToCollection (l, "5"));
		}
Beispiel #19
0
 public override void AddToCollection(object instance, object item)
 {
     xamlTypeInvoker.AddToCollection(instance, item);
 }
		public void AddToCollectionArrayInstance ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			var ax = new ArrayExtension ();
			i.AddToCollection (ax, 5);
		}