【发布时间】:2011-12-05 16:30:29
【问题描述】:
我有一个 WCF REST 服务。我想为操作编写集成测试。我正在考虑使用 HttpWebRequest 来编写这些(如Why does my C# client, POSTing to my WCF REST service, return (400) Bad Request? 中所述)。
我的问题是:我可以把HttpWebRequest代码放在一个事务作用域中,这样任何数据库操作在执行后都会回滚,比如:
using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
// use HttpWebRequest to execute REST service operation
}
这行得通吗?
【问题讨论】:
标签: c# wcf testing rest transactionscope