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_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 () { 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_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 (); 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. }