IndexOf() публичный Метод

public IndexOf ( CodeTypeDeclaration value ) : int
value CodeTypeDeclaration
Результат int
		public void Constructor1 ()
		{
			CodeTypeDeclaration td1 = new CodeTypeDeclaration ();
			CodeTypeDeclaration td2 = new CodeTypeDeclaration ();

			CodeTypeDeclaration[] declarations = new CodeTypeDeclaration[] { td1, td2 };
			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection (
				declarations);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (td1), "#2");
			Assert.AreEqual (1, coll.IndexOf (td2), "#3");
		}
		public void Constructor0_Deny_Unrestricted ()
		{
			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection ();
			Assert.AreEqual (0, coll.Add (ctd), "Add");
			Assert.AreSame (ctd, coll[0], "this[int]");
			coll.CopyTo (array, 0);
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (ctd), "Contains");
			Assert.AreEqual (0, coll.IndexOf (ctd), "IndexOf");
			coll.Insert (0, ctd);
			coll.Remove (ctd);
		}
		public void Constructor2 ()
		{
			CodeTypeDeclaration td1 = new CodeTypeDeclaration ();
			CodeTypeDeclaration td2 = new CodeTypeDeclaration ();

			CodeTypeDeclarationCollection c = new CodeTypeDeclarationCollection ();
			c.Add (td1);
			c.Add (td2);

			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection (c);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (td1), "#2");
			Assert.AreEqual (1, coll.IndexOf (td2), "#3");
		}
		public void Remove ()
		{
			CodeTypeDeclaration td1 = new CodeTypeDeclaration ();
			CodeTypeDeclaration td2 = new CodeTypeDeclaration ();

			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection ();
			coll.Add (td1);
			coll.Add (td2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (td1), "#2");
			Assert.AreEqual (1, coll.IndexOf (td2), "#3");
			coll.Remove (td1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (td1), "#5");
			Assert.AreEqual (0, coll.IndexOf (td2), "#6");
		}
		public void AddRange ()
		{
			CodeTypeDeclaration td1 = new CodeTypeDeclaration ();
			CodeTypeDeclaration td2 = new CodeTypeDeclaration ();
			CodeTypeDeclaration td3 = new CodeTypeDeclaration ();

			CodeTypeDeclarationCollection coll1 = new CodeTypeDeclarationCollection ();
			coll1.Add (td1);
			coll1.Add (td2);

			CodeTypeDeclarationCollection coll2 = new CodeTypeDeclarationCollection ();
			coll2.Add (td3);
			coll2.AddRange (coll1);
			Assert.AreEqual (3, coll2.Count, "#1");
			Assert.AreEqual (1, coll2.IndexOf (td1), "#2");
			Assert.AreEqual (2, coll2.IndexOf (td2), "#3");
			Assert.AreEqual (0, coll2.IndexOf (td3), "#4");

			CodeTypeDeclarationCollection coll3 = new CodeTypeDeclarationCollection ();
			coll3.Add (td3);
			coll3.AddRange (new CodeTypeDeclaration[] { td1, td2 });
			Assert.AreEqual (3, coll2.Count, "#5");
			Assert.AreEqual (1, coll2.IndexOf (td1), "#6");
			Assert.AreEqual (2, coll2.IndexOf (td2), "#7");
			Assert.AreEqual (0, coll2.IndexOf (td3), "#8");
		}