Reputation: 17580
I find myself writing new Mock<ISomeClass>();
then Alt + Enter
The result is (R# creates a variable):
var mock = new Mock<ISomeClass>();
I want it to be:
var someClassMock = new Mock<ISomeClass>();
Is there a way to configure the name Resharper gives the variable?
Upvotes: 3
Views: 163
Reputation: 31548
The closest I could recommend is creating a ReSharper live template to insert this for you. I use something very similar myself with FakeItEasy. Here's how you could do it:
mock
, add a descriptionvar $VARIABLE$Mock = new Mock<$TYPE$>();
TYPE
first, VARIABLE
secondVARIABLE
parameter, and select "Value of another variable with the first character in lower case"It should look something like this:
Now when you go to your code and type mock
, you'll generate a pattern where you would type your class or interface name inside new Mock<>()
, and it will prepend the name automatically. Sadly, I haven't found a good way to remove the i
from the generated name if it's an interface, so that's something you'll have to do manually...
Hope that helps.
Upvotes: 1