I use Data driven testing feature in MS test framework. [DataSource] attribute specifies table. C# Method is marked as [TestMethod]. It works but sometimes I need to stop execution. For example, table has 100 rows. How to explicitly (prematurely) exit test method (stop the rest of DDT invocations) after some condition, say during invocation of this method for 50-th row?
[DataSource("System.Data.SQLite", @"Data Source=D:\Test.db;", "TestTableName",
DataAccessMethod.Sequential)]
[TestMethod]
public void DataTest()
{
string userId = Convert.ToString(TestContext.DataRow["userid"]);
string telephone = Convert.ToString(TestContext.DataRow["telephone"]);
string email = Convert.ToString(TestContext.DataRow["email"]);
// .....
functionThatPerformsAssert(userId, telephone, email);
// .....
}