public void Constructor1_Deny_Unrestricted () { CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (array); coll.CopyTo (array, 0); Assert.AreEqual (1, coll.Add (ctr), "Add"); Assert.AreSame (ctr, coll[0], "this[int]"); coll.AddRange (array); coll.AddRange (coll); Assert.IsTrue (coll.Contains (ctr), "Contains"); Assert.AreEqual (0, coll.IndexOf (ctr), "IndexOf"); coll.Insert (0, ctr); coll.Remove (ctr); }
public void AddRange_Self () { CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (); coll.Add (new CodeTypeReference (string.Empty)); Assert.AreEqual (1, coll.Count, "#1"); coll.AddRange (coll); Assert.AreEqual (2, coll.Count, "#2"); }
public void AddRange_Null_Collection () { CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (); coll.AddRange ((CodeTypeReferenceCollection) null); }
public void AddRange () { CodeTypeReference ref1 = new CodeTypeReference (string.Empty); CodeTypeReference ref2 = new CodeTypeReference (string.Empty); CodeTypeReference ref3 = new CodeTypeReference (string.Empty); CodeTypeReferenceCollection coll1 = new CodeTypeReferenceCollection (); coll1.Add (ref1); coll1.Add (ref2); CodeTypeReferenceCollection coll2 = new CodeTypeReferenceCollection (); coll2.Add (ref3); coll2.AddRange (coll1); Assert.AreEqual (3, coll2.Count, "#1"); Assert.AreEqual (1, coll2.IndexOf (ref1), "#2"); Assert.AreEqual (2, coll2.IndexOf (ref2), "#3"); Assert.AreEqual (0, coll2.IndexOf (ref3), "#4"); CodeTypeReferenceCollection coll3 = new CodeTypeReferenceCollection (); coll3.Add (ref3); coll3.AddRange (new CodeTypeReference[] { ref1, ref2 }); Assert.AreEqual (3, coll2.Count, "#5"); Assert.AreEqual (1, coll2.IndexOf (ref1), "#6"); Assert.AreEqual (2, coll2.IndexOf (ref2), "#7"); Assert.AreEqual (0, coll2.IndexOf (ref3), "#8"); }