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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: