resharper

Generate DTOs from Object

吃可爱长大的小学妹 提交于 2019-12-01 04:23:14
I want to auto gen some DTOs from some of my existing objects, I was wondering if there already exist a Resharper, DevExpress or VSX open source to use, I need a tool to look into my code and let me choose which properties I want to include in my DTO and then generate a class based on that... This is kind of a hack but you could use Visual Studio/Resharper to Extract an interface from the class, then create a DTO class and derive from the interface, then use Visual Studio to auto implement the interface members (then, optionally remove the interface). Another opinion would be to use some

dotCover not showing all of the projects in a solution

℡╲_俬逩灬. 提交于 2019-12-01 04:19:10
问题 Let me start by saying I'm new to both ReSharper and dotCover and that I'm using v10.0.2 of both. The attached screenshot shows solution explorer in VS and the coverage tree for a set of tests. Whenever I run coverage, it always shows the same subset of assemblies in the coverage tree. Importantly, all of the tests shown are for code in either the Services or Infrastructure assemblies, neither of which show in the coverage tree. Clearly, the product is not doing something right or I'm not.

Resharper string.format shortcut

浪尽此生 提交于 2019-12-01 03:51:22
问题 I often find myself writing var message = "Hello {0}"; and then going back and typing in var message = string.Format("Hello {0}", world); It would be nice if as I were typing the string, when I put the " at the end, resharper figured out there was a parameter in the string and immediately surrounded the string with the string.Format method and put the cursor at the first argument. Is there a straightforward way to do this? I'm using Resharper 6.1 回答1: Just type it in dumber: "Hello " + world

Resharper 8.1 Test Runner slowing down Visual Studio Text Editing

假装没事ソ 提交于 2019-12-01 03:23:11
I've got a fairly small C# solution with about 5 projects in it. I am using Visual Studio 2012 with Update 4, and Resharper 8.1 (build 8.1.23.546). It's on an I7 with an SSD and 16GB RAM, with oodles of disk space. Performance on this machine is fantastic for everything else. I have R# set to be my unit test runner, and I've noticed that as soon as I run any unit tests (one or many, pass or fail, makes no difference), the Visual Studio text editor becomes almost unusable. Typing into the editor window suffers such extreme lag (up to 1 second between keystrokes) that it completely breaks down

Using IReadOnlyCollection<T> instead of IEnumerable<T> for parameters to avoid possible multiple enumeration

ε祈祈猫儿з 提交于 2019-12-01 03:18:56
My question is related to this one concerning the use of IEnumerable<T> vs IReadOnlyCollection<T> . I too have always used IEnumerable<T> to expose collections as both return types and parameters because it benefits from being both immutable and lazily executed. However, I am becoming increasingly concerned about the proliferation of places in my code where I must enumerate a parameter to avoid the possible multiple enumeration warning that ReSharper gives. I understand why ReSharper suggests this, and I agree with the code it suggests (below) in order to ensure encapsulation (i.e., no

Resharper Unit Test Runner Can't Find Content Files

做~自己de王妃 提交于 2019-12-01 03:07:20
I have some tests that rely on some files I have marked as "Content" and to "Always Copy". I'm using the DeploymentItem attribute to make sure they get copied to the output directory when running mstest outside of VS. However when using the Resharper test runner inside VS these files never make it to the directory that it is executing from. Anyone know how to fix this? Disabling the Unit Testing > Shadow-copy assemblies being tested Resharper option fixed this problem for me. We solved this problem by marking the test files as embedded resources and then used a utility method to read the

Is using “base” bad practice even though it might be good for readability?

家住魔仙堡 提交于 2019-12-01 03:02:59
I know this is a subjective question, but I'm always curious about best-practices in coding style. ReSharper 4.5 is giving me a warning for the keyword "base" before base method calls in implementation classes, i.e., base.DoCommonBaseBehaviorThing(); While I appreciate the "less is better" mentality, I also have spent a lot of time debugging/maintaining highly-chained applications, and feel like it might help to know that a member call is to a base object just by looking at it. It's simple enough to change ReSharper's rules, of course, but what do y'all think? Should "base" be used when

ReSharper run all unit tests in a project or solution at once

女生的网名这么多〃 提交于 2019-12-01 02:43:03
I am inside the IDE and I can run all the unit tests in a file but is there any way to run all test in a project or solution at once? Right click on the project or solution in the VS solution-explorer and choose 'Run Unit Tests' Or go to the Resharper menu, choose Unit-Testing and choose one of the options from there. If you learn executing menu commands with Alt-Letters, you can execute many commands fast even if they don't have direct shortcuts. Especially, if shortcuts are two-key combos. As for run ning all tests in solution the command is Alt- RUN , i.e. Alt-R for ReSharper menu, U for

Is ToArray() optimized for arrays?

霸气de小男生 提交于 2019-12-01 02:09:23
问题 ReSharper suggested to enumerate an IEnumerable<T> to a list or array since I had "possible multiple enumerations of IEnumerable<T> " . The automatic code re-factoring suggested has some optimization built in to see whether IEnumerable<T> already is an array before calling ToArray() . var list = source as T[] ?? source.ToArray(); Isn't this optimization already built-in the original LINQ method? If not, what would be the motivation not to do so? 回答1: Nope, there is no such optimization. If

ReSharper - how to disable generation of rubbish documentation headers in Code Cleanup

半世苍凉 提交于 2019-12-01 00:49:25
问题 We're using ReSharper 6.0 with StyleCop for ReSharper. Although we use the StyleCop rule that members must have documentation headers, we don't want ReSharper's code cleanup facility to generate documentation headers for us, because they're inevitably rubbish. Bad doc headers are worse than none at all because they're less likely to be updated than added in the first place. We tried turning off the setting 'Insert text into documentation and file headers' in ReSharper => Options => Tools =>