Example #1
0
 public void CreateInstanceList_ArgumentMismatch()
 {
     Assert.Throws(typeof(MissingMethodException), () =>
     {
         var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));
         i.CreateInstance(new object[] { "foo" });
     });
 }
Example #2
0
 public void CreateInstanceArray()
 {
     Assert.Throws(typeof(MissingMethodException), () =>
     {
         var i = new XamlTypeInvoker(new XamlType(typeof(int[]), sctx));
         i.CreateInstance(new object[0]);                 // no default constructor.
     });
 }
Example #3
0
 public void CreateInstanceNoUnderlyingType()
 {
     Assert.Throws(typeof(NotSupportedException), () =>
     {
         var i = new XamlTypeInvoker(new XamlType("urn:foo", "FooType", null, sctx));
         i.CreateInstance(new object[0]);                 // unknown type is not supported
     });
 }
Example #4
0
        public override object CreateInstance(object[] arguments)
        {
            object result = null;

            try
            {
                result = xamlTypeInvoker.CreateInstance(arguments);
            }
            catch (MissingMethodException)
            {
                result = xamlSerializer.ResolveInstance(xamlType.UnderlyingType, arguments);
            }

            if (result == null)
            {
                throw new MissingMethodException();
            }
            return(result);
        }
Example #5
0
        public void CreateInstanceList()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));

            i.CreateInstance(new object [0]);
        }
Example #6
0
        public void CreateInstanceList_ArgumentMismatch()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));

            i.CreateInstance(new object [] { "foo" });
        }
Example #7
0
        public void CreateInstanceArray()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(int []), sctx));

            i.CreateInstance(new object [0]);              // no default constructor.
        }
Example #8
0
        public void CreateInstanceNoUnderlyingType()
        {
            var i = new XamlTypeInvoker(new XamlType("urn:foo", "FooType", null, sctx));

            i.CreateInstance(new object [0]);              // unkown type is not supported
        }
        public void CreateInstanceNoUnderlyingType()
        {
            var i = new XamlTypeInvoker(new XamlType("urn:foo", "FooType", null, sctx));

            Assert.Throws <NotSupportedException> (() => i.CreateInstance(new object [0]));             // unkown type is not supported
        }
		public void CreateInstanceList ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			i.CreateInstance (new object [0]);
		}
		public void CreateInstanceList_ArgumentMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			Assert.Throws<MissingMethodException> (() => i.CreateInstance (new object [] {"foo"}));
		}
		public void CreateInstanceArray ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			Assert.Throws<MissingMethodException> (() => i.CreateInstance (new object [0])); // no default constructor.
		}
		public void CreateInstanceNoUnderlyingType ()
		{
			var i = new XamlTypeInvoker (new XamlType ("urn:foo", "FooType", null, sctx));
			Assert.Throws<NotSupportedException> (() => i.CreateInstance (new object [0])); // unkown type is not supported
		}
		public void CreateInstanceList_ArgumentMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			i.CreateInstance (new object [] {"foo"});
		}
		public void CreateInstanceArray ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			i.CreateInstance (new object [0]); // no default constructor.
		}
		public void CreateInstanceNoUnderlyingType ()
		{
			var i = new XamlTypeInvoker (new XamlType ("urn:foo", "FooType", null, sctx));
			i.CreateInstance (new object [0]); // unkown type is not supported
		}