IndexOf() public method

public IndexOf ( CodeTypeReference value ) : int
value CodeTypeReference
return int
		public void Constructor1 () 
		{
			CodeTypeReference ref1 = new CodeTypeReference (string.Empty);
			CodeTypeReference ref2 = new CodeTypeReference (string.Empty);

			CodeTypeReference[] refs = new CodeTypeReference[] { ref1, ref2 };
			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (
				refs);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ref1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ref2), "#3");
		}
		public void Constructor0_Deny_Unrestricted ()
		{
			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection ();
			Assert.AreEqual (0, coll.Add (ctr), "Add");
			Assert.AreSame (ctr, coll[0], "this[int]");
			coll.CopyTo (array, 0);
			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 Constructor2 () 
		{
			CodeTypeReference ref1 = new CodeTypeReference (string.Empty);
			CodeTypeReference ref2 = new CodeTypeReference (string.Empty);

			CodeTypeReferenceCollection c = new CodeTypeReferenceCollection ();
			c.Add (ref1);
			c.Add (ref2);

			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (c);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ref1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ref2), "#3");
		}
		public void Remove ()
		{
			CodeTypeReference ctr1 = new CodeTypeReference (string.Empty);
			CodeTypeReference ctr2 = new CodeTypeReference (string.Empty);

			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection ();
			coll.Add (ctr1);
			coll.Add (ctr2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ctr1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ctr2), "#3");
			coll.Remove (ctr1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (ctr1), "#5");
			Assert.AreEqual (0, coll.IndexOf (ctr2), "#6");
		}
		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");
		}
		public void Insert () 
		{
			CodeTypeReference ref1 = new CodeTypeReference (string.Empty);
			CodeTypeReference ref2 = new CodeTypeReference (string.Empty);

			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection ();
			coll.Add (ref1);
			Assert.AreEqual (1, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ref1), "#2");
			coll.Insert (0, ref2);
			Assert.AreEqual (2, coll.Count, "#3");
			Assert.AreEqual (1, coll.IndexOf (ref1), "#4");
			Assert.AreEqual (0, coll.IndexOf (ref2), "#5");
		}