public AddRange ( |
||
value | ||
Résultat | void |
public void Constructor1_Deny_Unrestricted () { CodeTypeMemberCollection coll = new CodeTypeMemberCollection (array); coll.CopyTo (array, 0); Assert.AreEqual (1, coll.Add (ctm), "Add"); Assert.AreSame (ctm, coll[0], "this[int]"); coll.AddRange (array); coll.AddRange (coll); Assert.IsTrue (coll.Contains (ctm), "Contains"); Assert.AreEqual (0, coll.IndexOf (ctm), "IndexOf"); coll.Insert (0, ctm); coll.Remove (ctm); }
public void AddRange_Null_Collection () { CodeTypeMemberCollection coll = new CodeTypeMemberCollection (); coll.AddRange ((CodeTypeMemberCollection) null); }
public void AddRange_Self () { CodeTypeMemberCollection coll = new CodeTypeMemberCollection (); coll.Add (new CodeTypeMember ()); Assert.AreEqual (1, coll.Count, "#1"); coll.AddRange (coll); Assert.AreEqual (2, coll.Count, "#2"); }
public void AddRange () { CodeTypeMember tm1 = new CodeTypeMember (); CodeTypeMember tm2 = new CodeTypeMember (); CodeTypeMember tm3 = new CodeTypeMember (); CodeTypeMemberCollection coll1 = new CodeTypeMemberCollection (); coll1.Add (tm1); coll1.Add (tm2); CodeTypeMemberCollection coll2 = new CodeTypeMemberCollection (); coll2.Add (tm3); coll2.AddRange (coll1); Assert.AreEqual (3, coll2.Count, "#1"); Assert.AreEqual (1, coll2.IndexOf (tm1), "#2"); Assert.AreEqual (2, coll2.IndexOf (tm2), "#3"); Assert.AreEqual (0, coll2.IndexOf (tm3), "#4"); CodeTypeMemberCollection coll3 = new CodeTypeMemberCollection (); coll3.Add (tm3); coll3.AddRange (new CodeTypeMember[] { tm1, tm2 }); Assert.AreEqual (3, coll2.Count, "#5"); Assert.AreEqual (1, coll2.IndexOf (tm1), "#6"); Assert.AreEqual (2, coll2.IndexOf (tm2), "#7"); Assert.AreEqual (0, coll2.IndexOf (tm3), "#8"); }