[Then(@”we verify that the (.*) row contains (.*) of (.*)”)]
public void ThenWeVerifyThatTheFirstRowCon tainsLInstIDOf410(String row, String field, String value)
{
SqlConnection ThisConnection = new SqlConnection(@”Server=1.1. 0.26;Database=pp5_410_LK;Trusted_Connection= True”);
ThisConnection.Open();
SqlCommand thisCommand = ThisConnection.CreateCommand() ;
if (String.Compare(row,”first”)== 0)
{
thisCommand.CommandText = “select * from CostCentre where sCostCentreNo in (select MAX(sCostCentreNo) from CostCentre where lInstID=410) and lInstID=410”;
}
if (String.Compare(row, “last”) == 0)
{
thisCommand.CommandText = “select * from CostCentre where sCostCentreNo in (select MIN(sCostCentreNo) from CostCentre where lInstID=410) and lInstID=410”;
}
SqlDataReader thisReader = thisCommand.ExecuteReader();
try
{
while (thisReader.Read())
{
Console.WriteLine(thisReader[ field].ToString());
Assert.AreEqual(value, thisReader[field].ToString());
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString() );
}
thisReader.Close();
ThisConnection.Close();
}
Leave a Reply