开发者

Unit Testing Custom Code Analysis Rules in 2010 - Any Hope

In the past it has been a real PITA to unit test custom Code Analysis rules. I haven't found anything out there that shows the situation to be any different i开发者_StackOverflow中文版n 2010, but I'm not giving up. If anyone knows if this is "possible" in 2010 please respond - thanks!


Johnathan,

I should've posted this sooner...I eventually figured this out in VS2010, and it's actually quite easy:

http://www.jasonbock.net/JB/Default.aspx?blog=entry.d6f6046800d945e6b94e8d92a4da52c2


Sounds like you have to do it the old fashioned way.

  1. Create a test project that demonstrates all the issues you are supposed to catch.
  2. Create a test harness that executes MSBuild against your test project and captures the output.
  3. Parse the results looking for the errors you intended.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜