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?

有帮助吗?

解决方案 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).

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top