I am attempting to compare an array to a list. The list contains 4 items that should be repeated in the array and in the same order. Previously all I had to do is make sure that each of the array values matched one of the list values, but now they must be validated to be the same and in the same order. This is what I had previously but am not sure how to change it. Can anyone help me with this one?
Range activity = this.excelWorkSheet.Columns.Range["D9:" + lastcell];
foreach (var value2 in activity.Value2)
{
var listofoptions = new List<string>
{
"a",
"b",
"c",
"d"
};
string metric = string.Empty;
for (int i = 0; i < listofoptions.Count; i++)
{
if (value2.ToString() == listofoptions[i])
{
metric = listofoptions[i];
Assert.IsTrue(value2.ToString().Contains(metric));
break;
}
}
if (metric == string.Empty)
{
Assert.Fail("Metric Type Invalid");
}