I'd like to know if anyone has found a solution for writing human-readable method tests names, so non-tech guys may read test list and they'll be able to understand what's going on, and, in instance, programmers won't need to use "non-tech-guy-friendly naming conventions" like "Whatever_Whatever2_Whatever3_DoesHelloWorldTest" anymore...?
There is a lot to be said for the clear and understandable convention:
MethodName_StateUnderTest_ExpectedBehavior
(not restricted to VS2010 or even .NET)
Related
I'm a Unity developer and just made the jump from Monodevelop to Visual Studio Community. Overall Visual Studio Community is a huge improvement but there is one thing I miss that Monodevelop did better: With Monodevelop's auto-completion, it would always sort the functions / variables by class. With VSC, it just shows every possible conclusion in alphabetical order, including all class and base class methods and properties.
So, in the example shown here, if I start by typing "PauseManager." in Monodevelop, it will show autocomplete suggestions first for PauseManager, and then below that for it's base class System.Object.
However when I type the same thing in Visual Studio, it will show me a huge list of methods and properties in alphabetical order, the majority of which I'm unlikely to be using.
This is a very simple example of a small class with only one ancestor; you can imagine that this gets especially unwieldy when I've got a class with a dozen public methods and multiple ancestors, each of which have their own public methods and properties.
I've looked at the documentation for Intellisense here: https://code.visualstudio.com/docs/editor/intellisense and I don't see any options for what I'm trying to accomplish.
Does anyone know of a way that this can be done? If not I may have to reluctantly go back to Monodevelop - looking through all these methods to sort out the ones relevant to what I'm doing it turning into an annoying little time waster.
Nope, apparently it is not possible currently.
There was an issue/feature request but they closed it 5 months ago with kind of "won't do" as answer.
They linked it to a "duplicate" issue though I honestly don't really see that as a duplicate ...
Maybe you can search for plugins but built-in it seems not possible currently .. what is a pity because now that I know it exists somewhere I also miss it a bit :'D
Go to
Tools -> Get Tools and Features -> Modify
If you have multiple versions, select the proper version.
Scroll down and find Visual Studio Development Extension.
Click the checkbox and hit Modify.
That's all you need to do.
Enjoy✌️
Using Visual Studio 2010, I keep running into a very annoying habit in its IntelliSense feature. Instead of prioritizing local variables and properties, it seems to default to picking whatever random class out of the standard libraries happens to have the same sequence of characters in the name. It's almost invariably some class I've never heard of or had any use for, and always completely inappropriate in the context. I'm finding myself having to type everything out fully instead, which begs the question of why I have IntelliSense in the first place?
Is there a way to make it choose local variables or properties first, since those are the things I'm most likely to use? Or failing that, it should choose classes within my current project over obscure random classes from the depths of the standard libraries. I know other IDEs work like this, such as Eclipse. I've looked at the options in VS, and pretty much the only thing I can do that helps is to check the "Pre-select most recently used member". That's great, but it seems like it should be possible to do better than that, perhaps keeping a stack of recently used members so you can get the next-most-recently used, etc.
we have a code base (VB.NET and C#) and a new coding standard. Do you have suggestions of tools that can move through a project and rename parameters/fields/properties/metothods etc according to the new coding standard.
It might for example need to change parameters into camel-case etc. One would imagine that parameters and local fields/variables are more easily renamed due to their local scope.
I have looked at ReSharper but haven't found that it performs this task.
Sounds like a job for ReSharper with the StyleCop plugin. Here's an example:
Parameters name camelCasing :
fields renaming :
Solution Cleanup :
Several options come into mind:
Resharper
JustCode
Depending on the version of your Visual Studio you have StyleCop built into it and you can enforce checkin rules in TFS that the code itself must comply with the guidelines before something can be checked in.
Something else: why did you change your coding standards all of a sudden and apparently go through all of your existing/production code to change it. I can imagine you want to enforce the new guidelines in new applications that need to be built or just started out.
Visual Studio is kind enough to generate a lot of code for us when we create and design Windows.Forms controls. It also surrounds most of it with a #region statement.
In newer versions it also uses a partial class to separate generated from manually created code.
Developers are supposed to edit code only in certain areas.
But nothing prevents us from violating this in whatever way we please.
I'm fine with manual edits that could just as well have been made from the designer, or manual edits in areas the designer doesn't touch. But I'd like to flag any other kind of edit.
Does anyone know a utility that can do this? StyleCop rules perhaps?
I mostly need it for the combination of C#, Windows.Forms, and Visual Studio 2003, 2005, and 2008.
These days, designer code should end up in a .Designer.cs file. It should be very rare that developers need to touch that. Unfortunately, I don't know any way of verifying that the code was genuinely generated by the designer. It would be handy if it included some sort of hash, but it doesn't as far as I'm aware...
Given how easy it is now to just say "don't edit designer files" do you really need another system though? It's not like you need to stay away from specific regions - it's the whole file which is out of bounds.
Why should developers not be allowed to change this code? If they are able to write code that works, they should be allowed to do it. If they are not able to write code that works, lets say they should be trained or fired.
You just have to extend the meaning of "it works" to "it works at runtime as well as in the designer". So what's wrong about that?
Todays gui designers are not very restrictive and are doing a good job in "understanding" code that had been written by a human.
There is also real generated code around, for instance code generated by some xml specification, resources etc. This code is generated when building, so when it had been changed, these changes are undone whenever the application is built.
Designers are not real code generators of this kind. They are a kind of "coding helpers", helping the developer to write code faster then by typing it in. But it should actually be possible to write the same kind of code manually although limiting one self to the designers capabilities is a reasonable maintainability decision.
My group has a source analysis tool that enforces certain styles that we have to comply with. I can't change it, and some of the rules are just a pain. One example is that all properties have to come before methods, and all constructors must come before properties. It seems silly to me that I have to take time to do something to the program when to the compiler it is the same. I would like some thing that is a plugin to VS that will let me do things like this automatically. Also, it would be nice to have it automatically put using's inside the namespace block.
You have different possibilities, depending on what exactly you want to do:
Resharper: There is a auto-format function which formats the source code of a single file or all files in the project / solution depending on your selected rules. So you set the settings for braces, naming, whitespaces, operators, lamdas, ... For more information see here. Resharper also supports settings a source- code file for all solutions or a shared settings file which is the same for all persons in the team.
FxCop: I havn't ever used this at work, but it's also a great tool an you can also select the rules which you want to enforce.
Unless they bake it into VS2010, Resharper has the auto formatting capabilities you're probably looking for. CodeSmith probably has it too, I just haven't used it...
There are some formatting options built into VS.
Goto Tools-->Options-->Text Editor-->C#-->Formatting.
They don't include every scenario, but might get you close.
Resharper - what a fantastic tool. I don't think I could manage without it. It must be the ultimate productivity tool for Visual Studio. Re-factoring, code analysis, code formatting, code completion - it has the lot.