public List<int> GetPortfolioList()
{
using (var connection = new SqlConnection("<connectionString>"))
using (var command = new SqlCommand("SELECT * FROM Portfolio", connection))
{
connection.Open();
var portfolioTable = SqlHelper.GetDataTable(command);
var portfolios = from DataRow row
in portfolioTable.Rows
select int.Parse(row["Portfolio"].ToString());
return portfolios.ToList();
}
}
Take this method in the SQL DAL provider to get a list of portfolios as the name (and code) suggests. Since the database table for integration testing contains a fairly static data set, we can argue against several expectations. for example, the Portfolio List will: - not be empty - contain certain known values - do not contain duplicates
- , ( ), . , , , , , , unit test . - ?