Domanda

In some unittest I want to refactor some block of code that is duplicate.

So I select a block of code for example the one below:

var timer = Substitute.For<ITimer>();
var alertSender = Substitute.For<IAlertSender>();
var alert = new Alert(NotificationType.Clear, new AlertConfiguration("test", 1, new List<string>()), timer, alertSender);

Unfortunately when resharper does create the method for me it does not detect identical block of code and refactor it for me as well. Is there any remedy to this issue?

È stato utile?

Soluzione 2

ReSharper doesn't do this out of the box, as @citizenmatt mentioned. However, there's a plugin for ReSharper called Agent Ralph that supposedly handles refactoring duplicated code blocks!

You can install it from the ReSharper Gallery if you have ReSharper 8 (it seems the plugin wasn't updated to use v8.2 yet, however).

Altri suggerimenti

ReSharper doesn't do this, but there's an issue open, please feel free to vote for it: http://youtrack.jetbrains.com/issue/RSRP-274811

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top