1

I would like to approval-test a result of a database query using classes provided by ApprovalTests.Net library. I understand how approval tests work, but could not find a single example on how to use classes from Persistence namespaces. Would appreciate some examples to get me started.

I am refactoring a complex Sql query. I need to make sure that the new version of the query is returning a same resultset after the refactoring. I think I can accomplish it like this:

DataSet dataSet = new DataSet();
dataSet.Fill(adapter, connection);
StringWriter sw = new StringWriter();
dataSet.WriteXml(sw);
string result = sw.ToString();
Approvals.Verify(result);

But I think there is a better way to do it using classes from Persistence namespace without explicit conversion of Dataset to xml string.

4

1 回答 1

2

Chris使用 ApprovalTests 制作了有关 ILoader 模式的截屏视频。

于 2014-07-01T05:17:31.533 回答