I’ve got a FxCop custom rule and I need to be able to create a integration test. I’m however having a hard time finding decent examples regarding this, since MS changed the API. Osherove’s FxCopUnit looks like the perfekt framework, but it also relies on the old FxCop API – Any thoughts?
Share
True unit testing of FxCop rules isn’t necessarily worth the investment necessary to build a proper unit testing framework for rules. Too much depends on the data and logic provided by the FxCop engine itself for the dependency to be mocked without introducing potentially serious deviations from behaviour of the actual engine. Most folks who test rules run mainly integration tests (including FxCopUnit, despite its name).
If you feel that an integration testing framework for FxCop rules would be useful, there is one included in the Bordecal FxCop rules framework. Documentation for its use is in the “The rule testing framework” section at http://bordecalfxcop.codeplex.com/documentation.