public void Constructor1 () { CodeCommentStatement ccs1 = new CodeCommentStatement (); CodeCommentStatement ccs2 = new CodeCommentStatement (); CodeCommentStatement[] statements = new CodeCommentStatement[] { ccs1, ccs2 }; CodeCommentStatementCollection coll = new CodeCommentStatementCollection ( statements); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (ccs1), "#2"); Assert.AreEqual (1, coll.IndexOf (ccs2), "#3"); }
public void Constructor0_Deny_Unrestricted () { CodeCommentStatementCollection coll = new CodeCommentStatementCollection (); Assert.AreEqual (0, coll.Add (ccs), "Add"); Assert.AreSame (ccs, coll[0], "this[int]"); coll.CopyTo (array, 0); coll.AddRange (array); coll.AddRange (coll); Assert.IsTrue (coll.Contains (ccs), "Contains"); Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf"); coll.Insert (0, ccs); coll.Remove (ccs); }
public void Constructor2 () { CodeCommentStatement ccs1 = new CodeCommentStatement (); CodeCommentStatement ccs2 = new CodeCommentStatement (); CodeCommentStatementCollection c = new CodeCommentStatementCollection (); c.Add (ccs1); c.Add (ccs2); CodeCommentStatementCollection coll = new CodeCommentStatementCollection (c); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (ccs1), "#2"); Assert.AreEqual (1, coll.IndexOf (ccs2), "#3"); }
public void Remove () { CodeCommentStatement ccs1 = new CodeCommentStatement (); CodeCommentStatement ccs2 = new CodeCommentStatement (); CodeCommentStatementCollection coll = new CodeCommentStatementCollection (); coll.Add (ccs1); coll.Add (ccs2); Assert.AreEqual (2, coll.Count, "#1"); Assert.AreEqual (0, coll.IndexOf (ccs1), "#2"); Assert.AreEqual (1, coll.IndexOf (ccs2), "#3"); coll.Remove (ccs1); Assert.AreEqual (1, coll.Count, "#4"); Assert.AreEqual (-1, coll.IndexOf (ccs1), "#5"); Assert.AreEqual (0, coll.IndexOf (ccs2), "#6"); }
public void AddRange () { CodeCommentStatement ccs1 = new CodeCommentStatement (); CodeCommentStatement ccs2 = new CodeCommentStatement (); CodeCommentStatement ccs3 = new CodeCommentStatement (); CodeCommentStatementCollection coll1 = new CodeCommentStatementCollection (); coll1.Add (ccs1); coll1.Add (ccs2); CodeCommentStatementCollection coll2 = new CodeCommentStatementCollection (); coll2.Add (ccs3); coll2.AddRange (coll1); Assert.AreEqual (3, coll2.Count, "#1"); Assert.AreEqual (1, coll2.IndexOf (ccs1), "#2"); Assert.AreEqual (2, coll2.IndexOf (ccs2), "#3"); Assert.AreEqual (0, coll2.IndexOf (ccs3), "#4"); CodeCommentStatementCollection coll3 = new CodeCommentStatementCollection (); coll3.Add (ccs3); coll3.AddRange (new CodeCommentStatement[] { ccs1, ccs2 }); Assert.AreEqual (3, coll2.Count, "#5"); Assert.AreEqual (1, coll2.IndexOf (ccs1), "#6"); Assert.AreEqual (2, coll2.IndexOf (ccs2), "#7"); Assert.AreEqual (0, coll2.IndexOf (ccs3), "#8"); }