We use FxCop for all of our projects. For our UnitTests I am not sure it is worth it. We end up with many suppresses:
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = SuppressJustifications.CA1822MethodIsUsedExternallyAsNonStatic)]
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Cantaloupe.Seed.Security.RijndaelEncryption", Justification = SuppressJustifications.CA1806MethodIsCalledForExceptionThrowingTest)]
What are people's thoughts on FxCop on Unit test code?
When I teach our unit test / TDD class, I usually tell people to write test code following the same principles as they would when writing prober production code. However, I acknowledge that some of the FxCop rules may generate too much noise.
Couldn't you use a suitable subset of the FxCop rules for the test code?
not worth the effort; FxCop is for production coding standards, not internal test code
(however, it doesn't hurt to give it a run-through and a once-over every now and then, in case it tells you something useful...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With