4

I'm using Machine.Specifications and I'm really annoyed by how VS2010/Resharper keeps trying to format my code... for example:

Establish context = () => the_cartoon_repository = DependencyOf<INHibernateRepository<Cartoon>>();

Gets turned into:

private Establish context = () => the_cartoon_repository = DependencyOf<INHibernateRepository<Cartoon>>();

As soon as I press enter. Argh! There's got to be a way around this, no?

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
chum of chance
  • 6,200
  • 10
  • 46
  • 74
  • 1
    Check the settings, probably just a setting to fix. I don't have resharper installed here, but I know the settings is quite extensive – Oskar Kjellin Jun 19 '11 at 00:10

2 Answers2

8

ReSharper options > Laguages > C# > Other > Modifiers:

Uncheck the Use explicit private modifier.

Jin-Wook Chung
  • 4,196
  • 1
  • 26
  • 45
  • 1
    The ReSharper option to not use explicit private modifiers will apply Solution-wide. I'm not ok with that in my projects. – Anthony Mastrean Jul 26 '11 at 21:50
  • 1
    I have the same problem. It is a bad idea to turn of this helpfull setting for all projects just for the sake of the unit tests. – bitbonk Aug 09 '11 at 09:43
  • Additionally, see [the blog post linked from the youtrack issue](http://blogs.jetbrains.com/dotnet/2012/01/per-project-settings-or-how-to-have-different-naming-styles-for-my-test-project/) for a workaround. – Carl G Sep 04 '13 at 01:43
2

The author of MSpec, Aaron Jensen, addresses a few formatting issues in this post. Specifically,

  • explicit private modifiers
  • weird lambda indentation
  • field naming warnings
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Alexander Groß
  • 10,200
  • 1
  • 30
  • 33