Data-Driven Unit Tests

See Book Wrox Professional Application Lifecycle Management p121
VS > Test > Windows > Test View > Select Test > Properties
Data Connection String .. Elipse or type “Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=True”
Data Table Name: Name of Schema.Table or View with data list

Alternatively in code:
    Public Property TestContext() As TestContext

    <TestMethod(), DataSource(“System.Data.SqlClient”, “Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=True”, “SchemaName.TableOrViewName”, DataAccessMethod.Sequential)> _
    Public Sub SQLViewTest()
TestContext.DataRow(ColumnName or Index).ToString

Leave a comment