A simple API with all the CRUD operations with In-Memory database.
- Retrieve All Products
- Description: Retrieves a list of all products.
- Response:
- Status: 200 OK
- Body: An array of ProductViewModel objects.
Example:
- Creates a new product.
- Description: Creates a new product.
- Response:The created ProductViewModel object with a unique id.
- Status: 201 Created if successful.
- Status: 400 Bad Request with problem details.
- Body: A ProductViewModel object with the product details.
Example:
- Retrieves a product.
- Description: Retrieves the details of a specific product by its ID.
- Response: The created ProductViewModel object with a unique id.
- Parameter: id - The unique identifier of the product.
- Status: 200 OK.
- Status: 404 Not Found.
Example:
- Updates a product.
- Description: Updates the details of an existing product.
- Request: A ProductViewModel object .
- Parameter: id - The unique identifier of the product.
- Response: 200 Ok if successful.
- Status: 200 OK.
- Status: 400 Bad Request with problems details.
Example:
- Deletes a product.
- Description: Removes an existing product by its ID.
- Parameter: id - The unique identifier of the product.
- Response: 204 No Content.
Example:
This pipeline is designed for practicing CI/CD by automatically building and testing the project using xUnit. It triggers on pushes to the main
branch and runs a series of steps to ensure the code is successfully built and passes all unit tests.
- Push: The pipeline runs whenever there is a push to the
main
branch.
- DOTNET_VERSION: Set to
8.0.x
, specifying the .NET version used in the pipeline.
- Checkout Code
- Action: Uses
actions/checkout@v4
to pull the latest code from themain
branch.
- Action: Uses
- Setup .NET
- Action: Uses
actions/setup-dotnet@v4
to install .NET SDK version specified byDOTNET_VERSION
.
- Action: Uses
- Install Dependencies
- Command:
dotnet restore
installs all project dependencies.
- Command:
- Build Project
- Command:
dotnet build --configuration Release --no-restore
builds the code in Release mode. The--no-restore
flag skips the dependency restore step, as it has already been completed.
- Command:
- Run Unit Tests
- Command:
dotnet test --configuration Release --no-build
runs the tests in Release mode, using xUnit as the test framework. The--no-build
flag skips the build step, as it has already been completed.
- Command: