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

            i.AddToCollection(l, "5");
        }
Пример #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));
        }
Пример #3
0
        public void AddToCollectionArrayInstance()
        {
            var i  = new XamlTypeInvoker(new XamlType(typeof(int []), sctx));
            var ax = new ArrayExtension();

            i.AddToCollection(ax, 5);
        }
Пример #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.
        }
Пример #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"));
        }
Пример #6
0
        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.
            }
        }
Пример #7
0
        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");
		}
Пример #9
0
        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.
        }
Пример #10
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.
		}
Пример #11
0
		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.
		}
Пример #12
0
		public void AddToCollectionList_ObjectTypeMismatch3 ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<object>), sctx));
			i.AddToCollection (new List<int> (), 5); // it is allowed too.
		}
Пример #13
0
		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.
			}
		}
Пример #14
0
		public void AddToCollectionArrayInstance ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			var ax = new ArrayExtension ();
			Assert.Throws<NotSupportedException> (() => i.AddToCollection (ax, 5));
		}
Пример #15
0
		public void AddToCollectionNoUnderlyingType ()
		{
			var i = new XamlTypeInvoker (new XamlType ("urn:foo", "FooType", null, sctx));
			i.AddToCollection (new List<int> (), 5); // ... passes.
		}
Пример #16
0
		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");
		}
Пример #17
0
        public void AddToCollectionList_ObjectTypeMismatch3()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <object>), sctx));

            i.AddToCollection(new List <int> (), 5);             // it is allowed too.
        }
Пример #18
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"));
		}
Пример #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);
		}