Introduction
An extension was created to help with repetitive tasks when developing Microservices. The extension is installed in Visual Studio and works with VS2019 and VS2022.
Usage
Common
All the refactoring actions offered by the tool are prefixed with "(iA) ..." to better identify the custom refactoring options.
PS: Only the available options are shown.
Without Resharper
- Select the item you want to refact.
- Click on the "Quick Action" icon.
- Select the refact option you want to apply.
With Resharper
Required settings
- In Resharper settings: "Environment/Editor/Visual Studio Features"
- Setup "Merge Visual Studio Quick Actions ..."
NOTE: Different settings can be used but the VS Quick Actions must be available.
How To Use
- Select the item you want to refact.
- Click on the "Action List" icon (Lightbulb or hammer).
- Select Rolsyn Actions
- Select the refact option you want to apply.
Features
(iA) Add Registration to Startup.cs
This feature adds the required registration ("services.AddScoped") to the startup file with the required "Usings".
The refact option is available on the class only.
Requirement
- The class selected must implement an interface
- The Startup.cs file must exist
- The Startup class must contain the method "ConfigureCustomServices(IServiceCollection services)"
- The interface must not already be registered in the method (even if with other class)
(iA) Create base unit tests
This feature creates the test class for the desired class. The test class includes:
- The test class inherits the BaseTestClass
- All the base "Usings" required for common tests
- A Mock property for every arguments of the main class constructor
- A constructor to initialize all the mocks
- A SubClass for every public method in the main class
- The sub class include one empty test
- The test class is created in the folder corresponding to the namespace of the main class
The refact option is available on the class only.
Requirement
- The TestProject must exist ( "{projectName}.Tests" )
- The TestClass must not already exist in the corresponding folder
(iA) Update base unit tests
This feature adds new method and new constructor parameters to the test class (including new "Usings").
The refact option is available on the class only.
Requirement
- The TestProject must exist ( "{projectName}.Tests" )
- The TestClass must already exist in the corresponding folder
Contribution
Repos: library-extensions-common-tasks-helper
Developed by: @