Renaming in tests doesn't seem to work
Using 5.1.1717.19
For the last few builds setting C# Naming Style - Advanced Naming Settings - Test method (property)/Test type to First_upper (default) no longer seems to be working properly.
Also when doing a Rename (Ctl-R-R) on a method called CreateTrialBalanceEtc sometimes the drop down does not offer Create_trial_balance_etc. If you cancel the dialog and then reopen it some 5 secs later the correct options are presented.
Very frustrating.
I'm also running CodeRush 10.1.4 (which I hope isn't causing these problems!)
Thanks
Jeremy
Please sign in to leave a comment.
Hello Jeremy,
Could you please clarify what do you mean by 'no longer seems to be working
properly'? I couldn't reproduce problems with Rename in build #1718. Thank
you!
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi Andrey
The normal behaviour for inconsistent naming is the blue wavy line below the item. You get to it by Alt-PgUp and then Alt-Enter to correct the naming. I set up Options to default to First_upper for Test Methods (in the advanced options), and also removed the alternative UpperCamelCase.
If my test code (NUnit) has a test called ShouldOfferToInsertUnderscoreInName() I expect to be offered it as a breach of the naming convention. Further if I do a Ctrl-R-R I quite often get offered
ShouldOfferToInsertUnderscoreIn
ShouldOfferToInsertUnderscore
ShouldOfferToInsert
instead of
Should_offer_to_insert_underscore_in_name
Should_offer_to_insert_underscore_in
Should_offer_to_insert_underscore
Should_offer_to_insert
If I Esc out of the dialog and then go back a few seconds later I get the correct option.
Under Languages - Common - Naming Style - I have left everything to the default values
Under Languages - C# - Naming Style - I have set up as per the attached image.
Let me know if there is any other information you need.
By the way I turned off CodeRush - it seemed to be conflicting heavily with R# particularly on pages with a lot of LINQ statement.
Regards
Jeremy
Attachment(s):
Naming.PNG
Hello Jeremy,
Could you please upgrade to the latest nightly build available at http://www.jetbrains.net/confluence/display/ReSharper/ReSharper5.1Nightly+Builds?
If this doesn't help, export your code style settings into an xml file (ReSharper
| Options | Languages | Common | Code Style Sharing) and attach that file
here. Thank you!
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi Andrey
The latest build 5.1.1720.15 still doesn't work.
Please see the attached image. Its not offering to rename method names in either a regular class or a testfixture.
Regards
Jeremy
Attachment(s):
Capture.PNG
jh_code_style_sharing.xml
Hello Jeremy,
The Class2.ThisShouldOfferToRename method on your screenshot is not a test
method since it's not marked with Test attribute, so it doesn't violate the
naming rules. What happens if you add '[Test]' attribute for that method?
Thank you!
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello Jeremy,
Nevermind my previous message. We managed to reproduce this problem and there
are actually two issues:
1. Open ReSharper | Options | Languages | C# | C# Naming Style, press 'Advanced
settings...' and make sure 'Event subscription on this' field is set to '$event$_Handler'
instead of '$event_Handler'. This should enable naming analysis for methods.
2. There's still some inconsistency with test methods and I've logged a bug-report:
http://youtrack.jetbrains.net/issue/RSRP-185042
Thank you!
Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hi Andrey,
That did the trick - thanks very much.
A similar issue (which was why I changed event subscriptions), is that if I type:
DataContext.Changed +=
Resharper offers to complete the event handler when I press Tab. I would expect (like) that it generates DataContext_OnChanged, but instead it generates DataContext_Changed.
I thought that the Event subscriptions on fields would do this - but it doesn't.
Regards
Jeremy
Hello,
Are you sure it's not a Visual Studio feature? I believe R# only offers Ctrl+Space
etc completion and does not have any tab-suggestions when sinking an event.
What happens if you suspend R# in Tools/Options/ReSharper/General?
—
Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”
Hi
You're quite right - I always thought it was a R# feature! (I can't remember a time that I haven't been using R# so I no longer know which are R# and which are native VS featues!)
Well... in that case .. it would be really nice if R# could intercept this and name the sink event as per the chosen naming convention :)
Regards
Jeremy