public IndexOf ( |
||
value | ||
return | int |
public void Constructor1 () { CodeAttributeArgument caa1 = new CodeAttributeArgument (); CodeAttributeArgument caa2 = new CodeAttributeArgument (); CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { caa1, caa2 }; CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ( arguments); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (caa1), "#2"); Assert.AreEqual (1, coll.IndexOf (caa2), "#3"); }
public void Constructor0_Deny_Unrestricted () { CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (); Assert.AreEqual (0, coll.Add (caa), "Add"); Assert.AreSame (caa, coll[0], "this[int]"); coll.CopyTo (array, 0); coll.AddRange (array); coll.AddRange (coll); Assert.IsTrue (coll.Contains (caa), "Contains"); Assert.AreEqual (0, coll.IndexOf (caa), "IndexOf"); coll.Insert (0, caa); coll.Remove (caa); }
public void Constructor2 () { CodeAttributeArgument caa1 = new CodeAttributeArgument (); CodeAttributeArgument caa2 = new CodeAttributeArgument (); CodeAttributeArgumentCollection c = new CodeAttributeArgumentCollection (); c.Add (caa1); c.Add (caa2); CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (c); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (caa1), "#2"); Assert.AreEqual (1, coll.IndexOf (caa2), "#3"); }
public void Remove () { CodeAttributeArgument caa1 = new CodeAttributeArgument (); CodeAttributeArgument caa2 = new CodeAttributeArgument (); CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (); coll.Add (caa1); coll.Add (caa2); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (caa1), "#2"); Assert.AreEqual (1, coll.IndexOf (caa2), "#3"); coll.Remove (caa1); Assert.AreEqual (1, coll.Count, "#4"); Assert.AreEqual (-1, coll.IndexOf (caa1), "#5"); Assert.AreEqual (0, coll.IndexOf (caa2), "#6"); }
public void AddRange () { CodeAttributeArgument caa1 = new CodeAttributeArgument (); CodeAttributeArgument caa2 = new CodeAttributeArgument (); CodeAttributeArgument caa3 = new CodeAttributeArgument (); CodeAttributeArgumentCollection coll1 = new CodeAttributeArgumentCollection (); coll1.Add (caa1); coll1.Add (caa2); CodeAttributeArgumentCollection coll2 = new CodeAttributeArgumentCollection(); coll2.Add (caa3); coll2.AddRange (coll1); Assert.AreEqual (3, coll2.Count, "#1"); Assert.AreEqual (1, coll2.IndexOf (caa1), "#2"); Assert.AreEqual (2, coll2.IndexOf (caa2), "#3"); Assert.AreEqual (0, coll2.IndexOf (caa3), "#4"); CodeAttributeArgumentCollection coll3 = new CodeAttributeArgumentCollection(); coll3.Add (caa3); coll3.AddRange (new CodeAttributeArgument[] {caa1, caa2}); Assert.AreEqual (3, coll2.Count, "#5"); Assert.AreEqual (1, coll2.IndexOf (caa1), "#6"); Assert.AreEqual (2, coll2.IndexOf (caa2), "#7"); Assert.AreEqual (0, coll2.IndexOf (caa3), "#8"); }