using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; [TestClass] public class ListIndexOfTests { [TestMethod] public void TestIndexOf() { ListIn this example, we create a List of integers and call the IndexOf method to find the index of the element with the value of 30. We then use an Assert statement to verify that the returned index is equal to 2. This method is a part of the Microsoft.VisualStudio.TestTools.UnitTesting package library.numbers = new List { 10, 20, 30, 40 }; int index = numbers.IndexOf(30); Assert.AreEqual(2, index); } }