# MikrocopTest This repository contains a .NET 10 solution with: - `MikrocopApi`: ASP.NET Core Web API - `MikrocopDb`: Entity Framework Core data access layer (SQLite) - `MikrocopTests`: NUnit test project ## Technologies Used - .NET SDK 10 (`net10.0`) - ASP.NET Core Web API - Entity Framework Core 10 - SQLite (`Microsoft.EntityFrameworkCore.Sqlite`) - JWT authentication (`Microsoft.AspNetCore.Authentication.JwtBearer`) - Swagger / OpenAPI (`Swashbuckle.AspNetCore`) - Serilog (console + rolling file logs) - NUnit + Moq + Microsoft.NET.Test.Sdk ## Prerequisites - .NET 10 SDK installed Check your installed version: ```bash dotnet --version ``` ## How to Run the Program From the repository root: ```bash dotnet restore dotnet run --project MikrocopApi ``` Notes: - In `Development`, EF Core migrations are applied automatically on startup. - Swagger UI is available at `http://localhost:5018/swagger` by default. - Development DB connection string is in `MikrocopApi/appsettings.Development.json` (`mikrocop.dev.db`). ## How to Use the API (JWT Flow) To use protected endpoints, follow this order: 1. Register a user with `POST /api/auth/register` 2. Log in with `POST /api/auth/login` 3. Copy the returned JWT token and send it as: `Authorization: Bearer ` Notes: - `api/auth/register` and `api/auth/login` are anonymous endpoints. - `api/users/*` endpoints require authentication (`[Authorize]`). - In Swagger, use the **Authorize** button and paste the token as `Bearer `. ## How to Run the Tests Run all tests in the solution: ```bash dotnet test MikrocopTest.sln ``` Or run only the test project: ```bash dotnet test MikrocopTests/MikrocopTests.csproj ```