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