im doing this simple for and i get this error. When i change TRUE to FALSE it doesnt give that error, but the test real error… but i need the test to pass and i dont understand.. can anybody help? C# visual studio 2010 NUnit
[Test]
public void prueba1()
{
List<int> lista1 = new List<int>();
lista1.Add(1);
lista1.Add(2);
lista1.Add(3);
for (int i = 0; i < lista1.Count; i++)
{
Console.WriteLine(lista1[i]);
Assert.True(lista1[i]<lista1[i+1]);
}
The valid indexes into your list are 0 through 2.
lista1.Countwill be 3, soigoes from 0 to 2. Wheniis 2, you try to accesslista1[i+1], which is out of range.