Data Driven Unit Tests in .NET 2.0

posted @ Thursday, October 27, 2005 12:48 AM

 

The new unit testing namespace provided with .NET 2.0 includes support for data-driven testing which is a great help when writing unit tests that deal with data access, or at least database access as it appears. The framework provides the DataSourceAttribute to specify your data source (fairly obvious), however, this attribute is really only designed for database access. What if my data source were an XML document or a 3rd party web service? Obviously there are other ways to access an XML document or a web service, such as through the Properties property of the TestContext. I'm just surprised the attribute wasn't called DatabaseAttribute. Thoughts?