C# Model to Builder Class
C# Model to Builder Class is a Visual Studio Code extension that will save you time by automatically generating a builder class from a C# model.
Stop wasting time manually writing out builder classes. Define a model and use this extension to generate your builder.
The generated file will be saved next to your model file with
If you're not already using builders, you should start. They are a great way to easily generate data for your unit tests.
If you are using this extension and find any issues or wish to add improvements, feel free to contribute.
Here is an example of using the generated builder to create a user for a test scenario.
Start with a model that you have written.
Run the extension
Manually update the generated file to take care of any required imports and set the default values.
Import the generated file into your test class.
To create a new user with the default values defined in the builder class use the following code.
If you want to override the default values you can specify unique values using
To use the extension: