CarbonCopy is a Visual Studio Extension for C# andVB.NET developers that generates the declaration and initialization of an object selected while debugging.
This lightweight tool (~14KB) is a must for test automation and refactoring.
The best way to grasp the potential of the tool is to illustrate it in action with one of many interesting uses.
Suppose you are refactoring a function that is not covered by anautomated test. While debugging an actual test case, the function returns an object that would take some time to declare from scratch in a test:
By selecting the object and clicking the "Copy declaration" menu item provided by CarbonCopy, its declaration is generated with the initialization of its current values and copied to theclipboard.
You can then paste this declaration as your expected result in an automated test and refactor the function infull confidence:
You are mocking your services calls with a framework such as Moq? This is another situation where CarbonCopy will help you with the mocking of requests/responses.
The extension supports C# and VB.NET languages;
Only Single-dimensional Arrays are supported yet;
Pasting the declaration from column 0 in the text editor usualy yields better results in regards to indentation;
You're probably violating Liskov substitution principle if you're getting an error such as:
'<type>' does not contain a definition for '<property>' and no extension method '<property>' accepting a first argument of type '<type>' could be found (are you missing a using directive or an assembly reference?).
Please feel free to report any error here.