예제 #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" });
     });
 }
예제 #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.
     });
 }
예제 #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
     });
 }
예제 #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);
        }
예제 #5
0
        public void CreateInstanceList()
        {
            var i = new XamlTypeInvoker(new XamlType(typeof(List <int>), sctx));

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

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

            i.CreateInstance(new object [0]);              // no default constructor.
        }
예제 #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
        }
예제 #9
0
        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
        }
예제 #10
0
		public void CreateInstanceList ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			i.CreateInstance (new object [0]);
		}
예제 #11
0
		public void CreateInstanceList_ArgumentMismatch ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (List<int>), sctx));
			Assert.Throws<MissingMethodException> (() => i.CreateInstance (new object [] {"foo"}));
		}
예제 #12
0
		public void CreateInstanceArray ()
		{
			var i = new XamlTypeInvoker (new XamlType (typeof (int []), sctx));
			Assert.Throws<MissingMethodException> (() => i.CreateInstance (new object [0])); // no default constructor.
		}
예제 #13
0
		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
		}