Suppose I'm following TDD and using VS/ReSharper. I start out writing a test like this:
[TestFixture]
class FooFixture
{
[Test]
public void ShouldDoSomething()
{
var foo = new Foo();
}
}
At this point, Foo
doesn't exist. ReSharper suggests the option of creating the class, but it puts it right next to my test class in my test project, not in my real project. So I have it create the class, then move it to a new file, then move the file to the right place, and finally fix the namespace. This seems like a lot of work.
Is there a more efficient way to quickly create the Foo
class and put it in the right place? It seems like the 'right place' could be guessed from the namespace of my test project.
Move types into matching class refactoring is used for this purpose.
You're expected to generate a number of business logic types in the current test class and then move them to matching files/namespaces in one go.
Note that this refactoring is available in the text editor and on Solution Explorer nodes, meaning that you can batch-apply it to a heck lot of files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With