I have a list that contain information that I want to assert. I want to assert in a table on a webpage
My Code looks:
for (var X = 0; X < test.Count; X++)
{
try
{
for (var i = 0; i <= 4; i++)
{
if (GetElement(i).Text == test[X].Type.ToString())
{
switch (test[X].Type)
{
case Enum.Type.X:
[Asserts]
break;
case Enum.Type.Y:
[Asserts]
break;
case Enum.Type.Z:
[Asserts]
break;
default:
break;
}
break;
}
}
break;
}
catch (NoSuchElementException)
{
throw new NoSuchElementException($"text");
}
}
What I want:
- I want that for each line in the list it goes to do if statement. If the statement is correct Assert Are Done.
- When Asserts are correct is should go back and start with the second record in the list (named test).
- If the if statement is never true a catch (NoSuchElementException) should appear.
The list looks has 4 fields, most of the time it has 3 records, sometimes 4 records depending on the situation.
I want each record in the list be checked.
Currently it only checks the first record in the list and then it stops. While I want each record in the list to be checked.
If more information is needed, let me know.