3

We want to follow One class per file rule in .NET? Is there a way to check this in a continuous integration system? We're using teamcity, but i guess the product doesn't matter.

Can this be checked by resharper, or is it possible to check this with a unit test(Without parsing files myself)?

Community
  • 1
  • 1
Manuel
  • 1,985
  • 3
  • 31
  • 51

2 Answers2

0

I think you can use nDepend to check that there's more then one class in each file

Dror Helper
  • 30,292
  • 15
  • 80
  • 129
0

ReSharper has a refactoring called Move Types into Matching Files that you can apply on the whole solution, if you need to, and that would put each type into a separate file, with the exception of inner types, of course.

Let it be said that I disagree strongly with the one class per file rule.

Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166
  • I'm aware that i can move a class into a new file by resharper, but i did not find the option to do this for the whole solution – Manuel May 14 '14 at 07:31